匿名用户2021年11月11日
32阅读
开发技术Python
所属分类人工智能、机器学习/深度学习
授权协议Readme

作品详情

gym-forex

TheForexenvironmentisaforextradingsimulatorfeaturing:configurableinitialcapital,dynamicordataset-basedspread,CSVhistorytimeseriesfortradingcurrenciesandobservationsfortheagent,fixedoragent-controlledtake-profit,stop-lossandordervolume.

Theenvironmentfeaturesdiscreteactionspacesandoptionallycontinuousactionspacesiftheordersdonthavefixedtake-profit/stop-lossandordervolume.

ObservationSpace

Aconcatenationofnum_ticksvectorsforthelastest:vectorofvaluesfromtimeseries,equityanditsvariation,order_status(-1=closed,1=opened),time_opened(normalizedwithmax_order_time),order_profitanditsvariation,order_drawdown/order_volume_pips,consecutive_drawdown/max_consecutive_dd

ActionSpace

discreteaction0:0=nop,1=close,2=buy,3=selldiscreteaction0parameter:symbol(optional)continuousaction0parameter:percent_tp,percent_sl,percent_max

RewardFunction

Therewardfunctionistheaverageoftheareaunderthecurveofequityandthebalancevariation.

MQL4DatasetGenerator

ThedatasetsusedforthetestsweregeneratedwithaMQL4programlocatedintheagentsfolder(Pendingdocumentation).

InstallationStep1-SetupDependencies

InstallPython,pip,OpenAIGymandotherdependencies:

sudoapt-getinstall-ypython3-numpypython3-devcmakezlib1g-devlibjpeg-devxvfbffmpeglibboost-all-devlibsdl2-devpython3-pipgitgccmakeperl

pip3installgraphvizneat-pythongitpythongymneat-pythonmatplotlib

Step2-Setupgym-forexfromGitHub

gitclonehttps://github.com/harveybc/gym-forex

Step3-ConfiguretheNEATparameters

SetthePYTHONPATHvenvironmentvariable,youmayaddthefollowinglinetothe.profilefileinyourhomedirectorytoexportonstartofsessions.Replacewithyourusername.

exportPYTHONPATH=/home/username/gym-forex/:${PYTHONPATH}

Step4-ConfiguretheNEATparameters

cdgym-forexnanoagents/config

Configurethepopulationsizeandotherparametersaccordingtoyourcomputingcapacityorrequirements,startwiththedefaults.

Step5-Configureastartup/restartscript

nanores

Forexample:

#!/bin/bashgitpullpython3agents/agent_NEAT.py./datasets/ts_5min_1w.CSV./datasets/vs_5min_1w.CSVconfig_20

Afterediting,changethepermissionofthefiletobeexecutable:

chmod777res

Step6-Startyouroptimizerthatusesthegym-forexenvironmentandanagent.

./res

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论