Skip to content
This repository has been archived by the owner on Nov 26, 2022. It is now read-only.

Exchange: support availabe spot values #335

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

brandsimon
Copy link
Contributor

The documentation says, that open, high, low, close, volume, price and last_traded is supported, but only close/price and volume was supported. I changed it now, but the documentation is still incorrect, because dt and data_frequency is not used. I think, the documentation just got copied from DataPortal::get_spot_value. I changed it, so I can use data.current for backtesting and live-trading.

I have not found tests for this, if I should write some, please let me know, where the appropriate place is.

@lenak25
Copy link
Contributor

lenak25 commented May 21, 2018

Thanks @brandsimon for your contribution.
You are correct regarding the documentation and the unsupported fields and your code is indeed addresses it.
However, your PR has raised a bigger issue which we should address before fixing the code: what information should be available in the current (which in live mode calls the exchange get_spot_value function).
As you know, in live the current information is retrieved from the ticker received from the exchange, which returns statistics for some period of time in recent past, usually last 24 hours.
While in backtest, when requesting current, the statistics of the current date-time used by the simulation are returned (1 minute OHLCV in minute mode and 1 day OHLCV in daily mode). So both modes are not aligned, except in their price/close value. In addition to supporting spot price in live, the volume was added as well, although it might have caused more confusion (we were requested to align the backtest volume to 24H at #259). So I think we should decide on what is the best approach before updating the code:

  1. Support only the price/close field at the current in both modes.
  2. Support only the price/close field at the current in live and continue supporting all other fields at backtest.
  3. Align the backtest mode to 24H and support all fields in both modes.
  4. Align only the volume to 24H at backetest and continue supporting only price + volume at live.

@brandsimon
Copy link
Contributor Author

@lenak25 Thank you for your response and explanation, I think I understand the underlying problem now (at least a bit better).

I dont think it is a good approach to support different fields in live and backtest mode, it is only confusing and I dont think, it is a good solution to have different code for backtest and live mode. So either solution 1 or 3 makes sense to me.

If I see it correctly, when I access the volume with current, in backtest mode I get the current volume (1T) and in live mode I get the 24hr volume. From the terminology "current", I would expect the current volume to be 1T (like I get the current price) and not the "history" volume.

Any thoughts on this?
Would it raise other problems (for example poloniex only provides 5T values)?

@lenak25
Copy link
Contributor

lenak25 commented May 24, 2018

You are correct, not all exchanges support the 1 minute frequency - Poloniex for example.
In any case, the information of the latest bar can be viewed using the data.history API as well (when supplying the required frequency - in case it supported, like discussed).
Thanks for you feedback, we will consider it when addressing this.
In any case, we will update the confusion documentation.
We will keep this PR open until this issue is resolved.
Thanks.

@brandsimon
Copy link
Contributor Author

Please let me know, if I can help with something.

@lenak25
Copy link
Contributor

lenak25 commented May 27, 2018

Thanks @brandsimon !

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.

2 participants