An error with ets and reading files

倾然丶 夕夏残阳落幕 提交于 2020-01-25 08:23:12

问题


Disclaimer: I didn't write this code, I'm just trying to make it work.

I'm trying to get the code from here working. The setup is an Ubuntu 14.04 64bit machine with Erlang installed.

The sequence of actions is as follows: What I'm doing is as follows:

  1. clone the code
  2. cd to the folder with the code and erl in terminal
  3. make:all([load]).
  4. polis:create().
  5. polis:start().
  6. benchmarker:start(slidingwindow50).

The errors I get are:

4> benchmarker:start(slidingwindow50).
true Dimensions:4,
Plasticity:none Dimensions:4, Plasticity:none Dimensions:4,
Plasticity:none Dimensions:4, Plasticity:none Dimensions:4,
Plasticity:none Dimensions:4, Plasticity:none Dimensions:4,
Plasticity:none Dimensions:4, Plasticity:none Dimensions:4,
Plasticity:none Dimensions:4, Plasticity:none

Specie_Id:6.858114617542796e-10 Morphology:forex_trader

******** Population monitor started with parameters:{state,benchmark,test,[], [],undefined,undefined,
undefined,[],0,0,0,0,0, undefined,undefined, undefined,undefined,
undefined,undefined,0.5, 10,10,mathema,inf,10000, inf,<0.274.0>,false}
Initial Tot Evaluations:0

Started Started Started Started Started Started Started

5> =ERROR REPORT==== 16-Mar-2016::14:11:34 === Error in process
<0.287.0> with exit value:
{badarg,[{ets,last,['EURUSD15'],[]},{fx,init_state,5,[{file,"fx.erl"},{line,375}]},{fx,sim,3,[{file,"fx.erl"},{line,284}]}]}

=ERROR REPORT==== 16-Mar-2016::14:11:34 === Error in process <0.288.0> with exit value:
{badarg,[{ets,last,['EURUSD15'],[]},{fx,init_state,5,[{file,"fx.erl"},{line,375}]},{fx,sim,3,[{file,"fx.erl"},{line,284}]}]}

Reviewing the code of fx.erl shows that the problem probably stems from the ets part and a .txt file not being read from disk and into a table in memory.

Update: I've been trying to investigate the function of fx. So far, I've had such results: fx:sim(anything) outputs "Started" and makes the shell unresponsive; fx:init(). results in

Initializing FX currency tables:[metadata,'EURUSD15','EURUSD30','EURUSD60'] FX metadata & currency tables initialized and written to file. ok

fx:loop(). outputs a lot of

New record inserted into table:'EURUSD15'

with the last line being

New FOREX_DB update starting with:{2009,6,16,7,30,0,15}

and then

=ERROR REPORT==== 22-Mar-2016::16:41:26 === Error in process <0.357.0> with exit value: {badarg,[{fx,insert_ForexRaw,2,[{file,"fx.erl"},{line,767}]},{fx,updater,1,[{file,"fx.erl"},{line,698}]},{fx,heartbeat,3,[{file,"fx.erl"},{line,692}]}]}

Running ets:i(). after fx:init(). shows no table called EURUSD15.

Why may that be, and how can I fix that?

P.S. If a working solution is found, I intend to ask for the changes to be merged with the original code (basically, I'll try a push request).


回答1:


I am familiar with that platform, and we are running it on our machines, we used it as our training material last year.

This is occurring because you didn't start the forex simulator before starting the benchmarker.



来源:https://stackoverflow.com/questions/36056420/an-error-with-ets-and-reading-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!