Table of contents
Install
pip install ejtraderRL -U
Install from source
git clone https://github.com/ejtraderLabs/ejtraderRL.git
cd trade-rl
pip install .
Technologies
| Technologies | version |
|---|---|
| python | >= 3.7 |
| tensorflow | >= 2.7.0 |
| numpy | >= 1.21.4 |
| pandas | >= 1.3.4 |
| ta | >= 0.7.0 |
how to run from Web app visual training
from ejtraderRL import app
app.web()
How to run from python script
from ejtraderRL import data, agent
# forex data
df = data.get_forex_data("EURUSD", "h1")
# stoch data
#df = data.get_stock_data("AAPL")
agent = agent.DQN(df=df, model_name="efficientnet_b0", lr=1e-4, pip_scale=25, n=3, use_device="cpu",
gamma=0.99, train_spread=0.2, balance=1000, spread=7, risk=0.01)
"""
:param df: pandas dataframe or csv file. Must contain open, low, high, close
:param lr: learning rate
:param model_name: None or model name, If None -> model is not created.
:param pip_scale: Controls the degree of overfitting
:param n: int
:param use_device: tpu or gpu or cpu
:param gamma: float
:param train_spread: Determine the degree of long-term training. The smaller the value, the more short-term the trade.
:param balance: Account size
:param spread: Cost of Trade
:param risk: What percentage of the balance is at risk
"""
agent.train()
Use custom model
from tensorflow.keras import layers, optimizers
from ejtraderRL import nn, agent, data
# forex data
df = data.get_forex_data("EURUSD", "h1")
# stoch data
df = data.get_stock_data("AAPL")
agent = agent.DQN(df=df, model_name=None, lr=1e-4, pip_scale=25, n=3, use_device="cpu",
gamma=0.99, train_spread=0.2, spread=7, balance=1000 risk=0.1)
def custom_model():
dim = 32
noise = layers.Dropout
noise_r = 0.1
inputs, x = nn.layers.inputs_f(agent.x.shape[1:], dim, 5, 1, False, "same", noise, noise_r)
x = nn.block.ConvBlock(dim, "conv1d", "resnet", 1, True, None, noise, noise_r)(x)
out = nn.layers.DQNOutput(2, None, noise, noise_r)(x)
model = nn.model.Model(inputs, x)
model.compile(optimizers.Adam(agent.lr, clipnorm=1.), nn.losses.DQNLoss)
return model
agent._build_model = custom_model
agent.build_model()
first release of the project is from komo135 thanks to @komo135
Metadata
Release files for ejtraderRL 1.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ejtraderRL-1.0.8.tar.gz | 23.9 kB | Without provenance | Details for ejtraderRL-1.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ejtraderRL-1.0.8-py3-none-any.whl | Python 3 | none | any | Details for ejtraderRL-1.0.8-py3-none-any.whl |
Total release size: 55.9 kB
Release files / ejtraderRL-1.0.8.tar.gz
| Download URL | ejtraderRL-1.0.8.tar.gz |
|---|---|
| Size | 23.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef1ae65735f70825356b3fa7913e759f287fa2358badfb8bd7c2826fe3c94c86
|
|
BLAKE2b-256 checksum How to use checksums |
db27f539b950b2a14c34d00183fbb730fe531e5871fe391f7f611e094d27c802
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.13
|
Release files / ejtraderRL-1.0.8-py3-none-any.whl
| Download URL | ejtraderRL-1.0.8-py3-none-any.whl |
|---|---|
| Size | 32.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89b07dc2a534a5397d5c0e82d403fdf08b976a3f1042224b8fc398d6f1880b8a
|
|
BLAKE2b-256 checksum How to use checksums |
d066ee75a4e06dad03e17bd4273c57fec2c1b0fd6cdfa6829e3ed798b4009cba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.13
|
Security for ejtraderRL 1.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.