Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

[WIP] ui trader #737

Merged
merged 42 commits into from
Jul 23, 2017
Merged

[WIP] ui trader #737

merged 42 commits into from
Jul 23, 2017

Conversation

askmike
Copy link
Owner

@askmike askmike commented May 5, 2017

Before we can add live trading (tradebot) to the UI, we need to do the following:

  • register at what prices and times orders where executed at.
  • hook into all risk & profit calculation logic (currently inside papertrader)
    • pull performance/risk calculation logic from paperTrader into new plugin
    • broadcast paper trader trades as "trade"
    • broadcast real trader trades as "trade"
  • expose via web UI
  • add web UI control panel where users can set API keys

@askmike askmike changed the base branch from stable to develop May 5, 2017 00:45
@generalectric
Copy link
Contributor

broadcast those as "trades"

Excited about this! Two questions though... How do I access indicator output via api.. Last I checked it simply isn't possible unless I'm blind... I mean can the ui parse indicator output? Am I blind? I want to contribute but I'm kinda road blocked.. Well not blocked I just find it easier to make forward progress tackling easier tasks. And number two... I saw another member created multi time frame ability... And tied that into strategies. I'm curious if ANYONE here actually makes decisions based on one time frame. Me personally I review 5 15 30 min, 2 and 4 hour candles before I make a decision.. I would think my strategies should do the same! Are there any plans for the ability to tie different indicators to different candle sizes? I believe this work has already been done... Could we get this implemented?

@askmike
Copy link
Owner Author

askmike commented May 6, 2017

To answer your questions I have to quickly go over Gekko's architecture. There is a document describing it here, but it's a but out of date. Very simply put this is how Gekko works:

screen shot 2017-05-06 at 11 56 15

This PR is to break the last part (paper trader) up into two different parts (paper trader & performance analyzer) this way we can use exactly the same code to calculate statistics, results, etc. for both the paper trader and real trader:

screen shot 2017-05-06 at 11 57 44

This will be necesarry to support live trading in the UI, since we need to display these statistics for the live trader just as the paper trader.


How do I access indicator output via api.. Last I checked it simply isn't possible unless I'm blind... I mean can the ui parse indicator output?

Those are not exposed yet, I have plans to do that (see #690). This is a completely separate issue as it will involve changing some code in the strategy logic (the second last box in the first picture - not the strats, but the wrapper code that registers indicators, updates them every candle, etc).

The live trader has higher priority for me.

I want to contribute but I'm kinda road blocked..

If you want to work on #690 that would be very hard (if you are not familiar with the codebase) since you have to touch the deepest/oldest parts of the codebase as well as the networking/UI logic in order to display the results. The gist is that gekko runs code on every candle (when it executes your update and check methods) here. This is where we need to take indicator output and push it through to the parent process. I am planning to work on that myself, but I want to do this first.

I saw another member created multi time frame ability... And tied that into strategies. I'm curious if ANYONE here actually makes decisions based on one time frame. Me personally I review 5 15 30 min, 2 and 4 hour candles before I make a decision.. I would think my strategies should do the same! Are there any plans for the ability to tie different indicators to different candle sizes? I believe this work has already been done... Could we get this implemented?

That user wanted this to be part of Gekko but I ended up not adding it as is because:

The aim of Gekko is to simplify trading strategies, but the required extra config (for everyone, even people who run simple strategies over a single timeframe) made it very complex to understand how to create a strategy for X timeframes and where to put code that was run under what timeframe. I am very open to a PR or issue discussing integrating that.

That said I think this would be a better approach:

Gekko has code that runs indicators based on candles, but now that is tighly coupled to the strat wrapping code. If we can decouple that as a simple class like so: put candle in --> [ x ] --> indicator result comes out. Once we have those we can very simply expose them to the strategies (in combination with the candleBatcher, a class that takes 1m candles and spits out Xm candles).


Can we please keep discussion on topic, eg. let's discuss the live trader here and other thing in the corresponding issue.

@askmike
Copy link
Owner Author

askmike commented Jun 6, 2017

live trading with the UI works for poloniex now:

screen shot 2017-06-07 at 00 42 47

but keys are required to be set in /api-keys.js (use this as a base)

@dghete dghete mentioned this pull request Jun 8, 2017
@long-einser
Copy link

long-einser commented Jun 14, 2017

what do I need to change at the simulation settings(asset, currency, fee,..) if I would like to trade live? or did I miss something? (i edited the code to support live trading ( e515a39 ))could someone post an example pls? ty for help&time

@askmike
Copy link
Owner Author

askmike commented Jun 14, 2017 via email

@long-einser
Copy link

long-einser commented Jun 16, 2017

Thank you for your fast reply.
I installd and tried the branch out for some days.
Problems I have now are..
I cant make backtests ( all calculations( show up as nan or nan%), same histroy backtested with branch stable it works.
I still have no clue what asset=1 does? I could imagine it but not 100% sure (currency choice?)
No trades in 2days.

have a nice weekend

@askmike
Copy link
Owner Author

askmike commented Jun 16, 2017

That branch is in development and all features are probably broken, it's not meant to be run right now (very unstable). Whenever I have free time I will work on that branch and improve it. Once it is finished it will be part of the develop branch and can be tested (with maybe just a few small bugs).

I still have no clue what asset=1 does?

This is a backtest setting (has no effect on real trading). When you run a backtest you are simulating with virtual money, asset=1 means that your virtual balance includes 1 asset (so bitcoin if you are simulating over a new branch). @long-einser please open a new issue if you have further questions. Your comments have nothing to do with the implementation of this issue.

@askmike
Copy link
Owner Author

askmike commented Jul 6, 2017

You can manage your API keys through the gekko UI!

It looks like this:

screen shot 2017-07-06 at 18 51 21


Only thing left to do before we can merge is:

  • When you start a trading bot, check whether the API keys are available, if not route to config page.
  • Test!

@askmike askmike merged commit f246a94 into develop Jul 23, 2017
@askmike askmike mentioned this pull request Jul 23, 2017
@askmike askmike deleted the feature/ui-trader branch July 23, 2017 22:20
@askmike askmike mentioned this pull request Jul 23, 2017
@CyborgDroid
Copy link

CyborgDroid commented Aug 16, 2017

Just to comment about the api-key configuration design... looks like you are developing it so that there is only 1 set of keys per exchange. Other than the fact that some individuals may want to trade on multiple accounts, Bitstamp have an amazing feature were you can set up sub-accounts. They have created this feature specifically with automated traders in mind. Each sub accounts has its own real-currency and cryptocurrency balances and separate API keys. It's great for traders who want to trade multiple cryptocurrencies or run different strategies simultaneously.

If you have multiple accounts trading at once you would need multiple strategies and settings running against those. This makes it a bit more complicated. But if we'll have multiple separate strategies, it would be great to add in there the ability to create a strategy (on a single account) that can run strategies with different candle sizes so you can compare them before signaling a buy/sell. For example: If strategy1 with 1hr candle size says SELL check that Strategy2 with 5min candle says sell as well, wait until it does before selling. Maybe its already possible, but doesn't seem so in the UI.

At that point you would be a step away from UI-ing the actual custom strategies with a logic builder since you would have a list of configured strategies.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants