Comments (2)
The bot doesn't manage data for you, see here #16
To access ohlcv data from a strategy you can do so from an AssetInstance
variable:
ai.data
is a dict where keys are timeframes and values are dataframes of ohlcv data. The first pair should always be the smallest timeframe of the strategy, which is the one you monitor for updates (during paper and live mode). The rest of the dataframes in the dict (if any) should be resampled (downsampled) from the smaller one.
For convenience the "main" timeframe of the asset instance (and strategy) can be accessed with the ohlcv property (ai.ohlcv
).
During backtest you need to pre populate the dataframes your self. There are utilities in the bot to download data in different ways.
see here a function to load data from the Scrapers
module https://github.com/panifie/PingPong.jl/blob/master/PingPong/test/env.jl
and here a function to load a strategy, and fill its assets with stub data https://github.com/panifie/PingPong.jl/blob/master/PingPong/test/env_strat.jl
During paper/live you create a Watcher
from the Watchers
module and use the watcher view which is a dict of dataframes (ohlcv) and use those dataframes in your strategy universe, see here where we create the watcher and fill the strategy universe with the data monitored by the watcher
PingPong.jl/user/strategies/Example.jl
Lines 26 to 28 in 2ef17a8
If you want to execute something at specified interval the simplest approach is to just track timestamps:
isstale15m(s, ts) = ts - attr(s, :job_15m, DateTime(0)) > tf"15m"
job15m(s, ts, ats) = (println("Running job every 15m"); setattr!(s, :job_15m, ts))
function ping!(s, ts::DateTime, args...)
ats = available(ts)
isstale15m(s, ts) && job15m(s, ts, ats)
end
A fancier approach would involve using either Rocket.jl or DiscreteEvents.jl but I don't think that's necessary, If I implement it it would be more like an optional feature where you can call a pong!
function and get a virtual clock to which you can subscribe functions that run at a particular time, and that clock would be replaced with a realtime clock in paper/live mode.
from pingpong.jl.
An important concept in Trality bots is the concept of "handler" https://docs.trality.com/trality-code-editor/core-concepts/overview
See for example https://gist.github.com/c0indev3l/855381f07865dfca079e8252e736ae35#file-two_intervals-py
Functions are schedule to be run periodically (every hour for one and every 15 minutes for an other one).
My guess is that their bot is composed of several parts. When live trading, one part is probably simply receiving price data and storing them into a database (maybe a TSDB). An other part is responsible of scheduling what function will have to be executed in the future. A third one is responsible of executing scheduled function at expected time. What is your opinion about that ?
from pingpong.jl.
Related Issues (20)
- Profitability calculator
- Project status HOT 1
- UndefVarError: `scr` not defined HOT 1
- bn.binancedownload(pairs) raises ERROR: ArgumentError: No symbols found matching SubString{String}["BTC/USDT", "ETH/USDT", "SOL/USDT"] HOT 2
- Attempting to build a docker image under osx fails.
- Failed to install manually according to the official website documentation HOT 5
- load_ohlcv(s) : ERROR: UndefVarError: `compactun` not defined HOT 1
- [PingPongInteractive] ERROR: LoadError: UndefVarError: `za` not defined
- LoadError: Creating a new global in closed module `Main` (`resp`) breaks incremental compilation
- Several errors in Performance Metrics HOT 1
- [Stats.multi] ERROR: ArgumentError: column name :cum_balance not found in the data frame
- [Help] Python: AuthenticationError: binance {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."} HOT 2
- Once again, missing keyword arguments in the function signature.
- bn.binanceload() load nothing HOT 1
- bn.binancedownload() failed. HOT 2
- [Help] How do I choose which project to execute the script in? HOT 2
- The behavior of bn.binancedownload(freq=:daily) is strange. HOT 3
- [Help] How to debug(stepinto) in vscode? HOT 3
- ERROR: LoadError: InitError: Evaluation into the closed module `PingPong` breaks incremental compilation because the side effects will not be permanent. HOT 3
- [Help] questions about Quickstart examples. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pingpong.jl.