Merge pull request #1901 from yperfanov/bid_ask_strategy
Bid ask strategy
This commit is contained in:
commit
08105641d9
@ -298,6 +298,18 @@ if self.dp:
|
|||||||
!!! Warning Warning in hyperopt
|
!!! Warning Warning in hyperopt
|
||||||
This option cannot currently be used during hyperopt.
|
This option cannot currently be used during hyperopt.
|
||||||
|
|
||||||
|
#### Orderbook
|
||||||
|
|
||||||
|
``` python
|
||||||
|
if self.dp:
|
||||||
|
if self.dp.runmode in ('live', 'dry_run'):
|
||||||
|
ob = self.dp.orderbook(metadata['pair'], 1)
|
||||||
|
dataframe['best_bid'] = ob['bids'][0][0]
|
||||||
|
dataframe['best_ask'] = ob['asks'][0][0]
|
||||||
|
```
|
||||||
|
!Warning The order book is not part of the historic data which means backtesting and hyperopt will not work if this
|
||||||
|
method is used.
|
||||||
|
|
||||||
#### Available Pairs
|
#### Available Pairs
|
||||||
|
|
||||||
``` python
|
``` python
|
||||||
@ -306,6 +318,7 @@ if self.dp:
|
|||||||
print(f"available {pair}, {ticker}")
|
print(f"available {pair}, {ticker}")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
#### Get data for non-tradeable pairs
|
#### Get data for non-tradeable pairs
|
||||||
|
|
||||||
Data for additional, informative pairs (reference pairs) can be beneficial for some strategies.
|
Data for additional, informative pairs (reference pairs) can be beneficial for some strategies.
|
||||||
|
@ -85,8 +85,7 @@ class DataProvider(object):
|
|||||||
"""
|
"""
|
||||||
return latest orderbook data
|
return latest orderbook data
|
||||||
"""
|
"""
|
||||||
# TODO: Implement me
|
return self._exchange.get_order_book(pair, max)
|
||||||
pass
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def runmode(self) -> RunMode:
|
def runmode(self) -> RunMode:
|
||||||
|
@ -253,6 +253,17 @@ class TestStrategy(IStrategy):
|
|||||||
dataframe['ha_low'] = heikinashi['low']
|
dataframe['ha_low'] = heikinashi['low']
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Retrieve best bid and best ask
|
||||||
|
# ------------------------------------
|
||||||
|
"""
|
||||||
|
# first check if dataprovider is available
|
||||||
|
if self.dp:
|
||||||
|
if self.dp.runmode in ('live', 'dry_run'):
|
||||||
|
ob = self.dp.orderbook(metadata['pair'], 1)
|
||||||
|
dataframe['best_bid'] = ob['bids'][0][0]
|
||||||
|
dataframe['best_ask'] = ob['asks'][0][0]
|
||||||
|
"""
|
||||||
|
|
||||||
return dataframe
|
return dataframe
|
||||||
|
|
||||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||||
|
Loading…
Reference in New Issue
Block a user