simple-back icon indicating copy to clipboard operation
simple-back copied to clipboard

crypto support

Open MiniXC opened this issue 4 years ago • 8 comments

Tasks

  • [ ] ~make it possible to disable the current limitation of only buying full shares~
  • [ ] make fractional shares a BacktesterBuilder option, with default set to False
  • [ ] find free data source for daily crypto data
  • [ ] provide crypto PriceDataProvider
  • [ ] BacktesterBuilder.interval for intra-day backtesting

MiniXC avatar Jun 30 '20 12:06 MiniXC

To be clear here, I can buy partial shares already, the num_shares is not restricted to ints so it behaves like I would expect, that being said, it implies that you can buy partial shares if someone was to use this for traditional markets.

R-K-H avatar Jun 30 '20 12:06 R-K-H

Thanks for pointing that out, the backtester will fail though when you specify a percentage to buy and one share is more costly than said percentage. I'll have to make this behaviour consistent.

MiniXC avatar Jun 30 '20 12:06 MiniXC

Free no API key:

  • coingecko.com/en/api
  • docs.coincap.io

Free, but requiring an API key:

  • nomics.com
  • quandl.com ('BITFINEX:BTCUSD')
  • min-api.cryptocompare.com
  • coinapi.io
  • coinlayer.com
  • coinmarketcap.com/api/
  • developers.shrimpy.io

R-K-H avatar Jul 02 '20 23:07 R-K-H

Looked a bit more into it and would say that for crypto, the current open/close setup really doesn't make sense. We would need to add something like .interval('1m') instead of .calendar. It's definitely doable, the backtester uses a list of datetimes with the correct open/close times already so it wouldn't be a complete overhaul. I don't have the resources to work on this at the moment though - any help/pull request is appreciated.

MiniXC avatar Jul 03 '20 08:07 MiniXC

Well exchanges have Kline/Candlestick data with OHLCV data so assuming you adjust the frequency or just respect the frequency of the dataset, would you be able to use that in place or is it hard coded for the specific interval vs just the open and close on date time.

https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data

One of the better ways to do backtesting is through orderbooks or at the very least trade data (which can be fetched through most exchanges, but it complicates things).

However without making this crypto specific, perhaps candlestick data formatted at whatever interval should work?

R-K-H avatar Jul 05 '20 22:07 R-K-H

One of the better ways to do backtesting is through orderbooks or at the very least trade data (which can be fetched through most exchanges, but it complicates things).

As interesting as it would be, my focus for simple-back was to make something working with freely available data and for strategies with longer time horizons (I think if you don't work for a hedge fund/bank you only have a chance with alternative data over longer timespans).

Well exchanges have Kline/Candlestick data with OHLCV data so assuming you adjust the frequency or just respect the frequency of the dataset, would you be able to use that in place or is it hard coded for the specific interval vs just the open and close on date time. https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data

I had a quick look over the apis you linked before, but didn't come across this. Thanks for linking it. I can use this to build a DailyPriceProvider with binance as a data source. I won't get to it to soon though unfortunatly, I'm currently working on adding other features I experimented with in notebooks. If you want to tackle this @R-K-H a good starting point would be YahooFinanceProvider

MiniXC avatar Jul 07 '20 07:07 MiniXC

As interesting as it would be, my focus for simple-back was to make something working with freely available data and for strategies with longer time horizons (I think if you don't work for a hedge fund/bank you only have a chance with alternative data over longer timespans).

Completely understand and agree with you, just wanted to further the ideation for posterity.

I had a quick look over the apis you linked before, but didn't come across this. Thanks for linking it. I can use this to build a DailyPriceProvider with binance as a data source. I won't get to it to soon though unfortunatly, I'm currently working on adding other features I experimented with in notebooks. If you want to tackle this @R-K-H a good starting point would be YahooFinanceProvider

Sure thing, I've been using your stuff to test some things out (why I posted in the first place). I'll see what I can do to clean it up and issue a PR. Don't expect anything soon though. Happy to help if I can.

R-K-H avatar Jul 07 '20 08:07 R-K-H

Thanks, I will post here should I get to it sooner than expected.

MiniXC avatar Jul 07 '20 11:07 MiniXC