parametrize outdated_offset to simplify sandbox usage
This commit is contained in:
parent
eca5c6f389
commit
c9580b31d0
@ -41,7 +41,8 @@
|
|||||||
],
|
],
|
||||||
"pair_blacklist": [
|
"pair_blacklist": [
|
||||||
"DOGE/BTC"
|
"DOGE/BTC"
|
||||||
]
|
],
|
||||||
|
"outdated_offset": 5
|
||||||
},
|
},
|
||||||
"experimental": {
|
"experimental": {
|
||||||
"use_sell_signal": false,
|
"use_sell_signal": false,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# Sandbox API testing
|
# Sandbox API testing
|
||||||
|
|
||||||
Where an exchange provides a sandbox for risk-free integration, or end-to-end, testing CCXT provides access to these.
|
Where an exchange provides a sandbox for risk-free integration, or end-to-end, testing CCXT provides access to these.
|
||||||
|
|
||||||
This document is a *light overview of configuring Freqtrade and GDAX sandbox.
|
This document is a *light overview of configuring Freqtrade and GDAX sandbox.
|
||||||
@ -11,8 +12,11 @@ https://public.sandbox.gdax.com
|
|||||||
https://api-public.sandbox.gdax.com
|
https://api-public.sandbox.gdax.com
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Configure a Sandbox account on Gdax
|
# Configure a Sandbox account on Gdax
|
||||||
|
|
||||||
Aim of this document section
|
Aim of this document section
|
||||||
|
|
||||||
- An sanbox account
|
- An sanbox account
|
||||||
- create 2FA (needed to create an API)
|
- create 2FA (needed to create an API)
|
||||||
- Add test 50BTC to account
|
- Add test 50BTC to account
|
||||||
@ -30,29 +34,34 @@ After registration and Email confimation you wil be redirected into your sanbox
|
|||||||
> https://public.sandbox.pro.coinbase.com/
|
> https://public.sandbox.pro.coinbase.com/
|
||||||
|
|
||||||
## Enable 2Fa (a prerequisite to creating sandbox API Keys)
|
## Enable 2Fa (a prerequisite to creating sandbox API Keys)
|
||||||
|
|
||||||
From within sand box site select your profile, top right.
|
From within sand box site select your profile, top right.
|
||||||
>Or as a direct link: https://public.sandbox.pro.coinbase.com/profile
|
>Or as a direct link: https://public.sandbox.pro.coinbase.com/profile
|
||||||
|
|
||||||
From the menu panel to the left of the screen select
|
From the menu panel to the left of the screen select
|
||||||
|
|
||||||
> Security: "*View or Update*"
|
> Security: "*View or Update*"
|
||||||
|
|
||||||
In the new site select "enable authenticator" as typical google Authenticator.
|
In the new site select "enable authenticator" as typical google Authenticator.
|
||||||
|
|
||||||
- open Google Authenticator on your phone
|
- open Google Authenticator on your phone
|
||||||
- scan barcode
|
- scan barcode
|
||||||
- enter your generated 2fa
|
- enter your generated 2fa
|
||||||
|
|
||||||
## Enable API Access
|
## Enable API Access
|
||||||
|
|
||||||
From within sandbox select profile>api>create api-keys
|
From within sandbox select profile>api>create api-keys
|
||||||
>or as a direct link: https://public.sandbox.pro.coinbase.com/profile/api
|
>or as a direct link: https://public.sandbox.pro.coinbase.com/profile/api
|
||||||
|
|
||||||
Click on "create one" and ensure **view** and **trade** are "checked" and sumbit your 2Fa
|
Click on "create one" and ensure **view** and **trade** are "checked" and sumbit your 2FA
|
||||||
|
|
||||||
- **Copy and paste the Passphase** into a notepade this will be needed later
|
- **Copy and paste the Passphase** into a notepade this will be needed later
|
||||||
- **Copy and paste the API Secret** popup into a notepad this will needed later
|
- **Copy and paste the API Secret** popup into a notepad this will needed later
|
||||||
- **Copy and paste the API Key** into a notepad this will needed later
|
- **Copy and paste the API Key** into a notepad this will needed later
|
||||||
|
|
||||||
## Add 50 BTC test funds
|
## Add 50 BTC test funds
|
||||||
To add funds, use the web interface deposit and withdraw buttons.
|
|
||||||
|
|
||||||
|
To add funds, use the web interface deposit and withdraw buttons.
|
||||||
|
|
||||||
To begin select 'Wallets' from the top menu.
|
To begin select 'Wallets' from the top menu.
|
||||||
> Or as a direct link: https://public.sandbox.pro.coinbase.com/wallets
|
> Or as a direct link: https://public.sandbox.pro.coinbase.com/wallets
|
||||||
@ -64,88 +73,69 @@ To begin select 'Wallets' from the top menu.
|
|||||||
- - - - - Deposit
|
- - - - - Deposit
|
||||||
|
|
||||||
*This process may be repeated for other currencies, ETH as example*
|
*This process may be repeated for other currencies, ETH as example*
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Configure Freqtrade to use Gax Sandbox
|
# Configure Freqtrade to use Gax Sandbox
|
||||||
|
|
||||||
The aim of this document section
|
The aim of this document section
|
||||||
- Enable sandbox URLs in Freqtrade
|
|
||||||
- Configure API
|
- Enable sandbox URLs in Freqtrade
|
||||||
- - secret
|
- Configure API
|
||||||
- - key
|
- - secret
|
||||||
- - passphrase
|
- - key
|
||||||
|
- - passphrase
|
||||||
|
|
||||||
## Sandbox URLs
|
## Sandbox URLs
|
||||||
|
|
||||||
Freqtrade makes use of CCXT which in turn provides a list of URLs to Freqtrade.
|
Freqtrade makes use of CCXT which in turn provides a list of URLs to Freqtrade.
|
||||||
These include `['test']` and `['api']`.
|
These include `['test']` and `['api']`.
|
||||||
|
|
||||||
- `[Test]` if available will point to an Exchanges sandbox.
|
- `[Test]` if available will point to an Exchanges sandbox.
|
||||||
- `[Api]` normally used, and resolves to live API target on the exchange
|
- `[Api]` normally used, and resolves to live API target on the exchange
|
||||||
|
|
||||||
To make use of sandbox / test add "sandbox": true, to your config.json
|
To make use of sandbox / test add "sandbox": true, to your config.json
|
||||||
```
|
|
||||||
|
```json
|
||||||
"exchange": {
|
"exchange": {
|
||||||
"name": "gdax",
|
"name": "gdax",
|
||||||
"sandbox": true,
|
"sandbox": true,
|
||||||
"key": "5wowfxemogxeowo;heiohgmd",
|
"key": "5wowfxemogxeowo;heiohgmd",
|
||||||
"secret": "/ZMH1P62rCVmwefewrgcewX8nh4gob+lywxfwfxwwfxwfNsH1ySgvWCUR/w==",
|
"secret": "/ZMH1P62rCVmwefewrgcewX8nh4gob+lywxfwfxwwfxwfNsH1ySgvWCUR/w==",
|
||||||
"password": "1bkjfkhfhfu6sr",
|
"password": "1bkjfkhfhfu6sr",
|
||||||
|
"outdated_offset": 5
|
||||||
"pair_whitelist": [
|
"pair_whitelist": [
|
||||||
"BTC/USD"
|
"BTC/USD"
|
||||||
```
|
```
|
||||||
|
|
||||||
Also insert your
|
Also insert your
|
||||||
|
|
||||||
- api-key (noted earlier)
|
- api-key (noted earlier)
|
||||||
- api-secret (noted earlier)
|
- api-secret (noted earlier)
|
||||||
- password (the passphrase - noted earlier)
|
- password (the passphrase - noted earlier)
|
||||||
|
|
||||||
---
|
---
|
||||||
## You should now be ready to test your sandbox!
|
|
||||||
|
## You should now be ready to test your sandbox
|
||||||
|
|
||||||
Ensure Freqtrade logs show the sandbox URL, and trades made are shown in sandbox.
|
Ensure Freqtrade logs show the sandbox URL, and trades made are shown in sandbox.
|
||||||
** Typically the BTC/USD has the most activity in sandbox to test against.
|
** Typically the BTC/USD has the most activity in sandbox to test against.
|
||||||
|
|
||||||
## GDAX - Old Candles problem
|
## GDAX - Old Candles problem
|
||||||
It is my experience that GDAX sandbox candles may be 20+- minutes out of date. This can cause trades to fail as one of Freqtrades safety checks
|
|
||||||
|
|
||||||
To disable this check, edit:
|
It is my experience that GDAX sandbox candles may be 20+- minutes out of date. This can cause trades to fail as one of Freqtrades safety checks.
|
||||||
>strategy/interface.py
|
|
||||||
Look for the following section:
|
|
||||||
```
|
|
||||||
# Check if dataframe is out of date
|
|
||||||
signal_date = arrow.get(latest['date'])
|
|
||||||
interval_minutes = constants.TICKER_INTERVAL_MINUTES[interval]
|
|
||||||
if signal_date < (arrow.utcnow().shift(minutes=-(interval_minutes * 2 + 5))):
|
|
||||||
logger.warning(
|
|
||||||
'Outdated history for pair %s. Last tick is %s minutes old',
|
|
||||||
pair,
|
|
||||||
(arrow.utcnow() - signal_date).seconds // 60
|
|
||||||
)
|
|
||||||
return False, False
|
|
||||||
```
|
|
||||||
|
|
||||||
You could Hash out the entire check as follows:
|
To disable this check, add / change the `"outdated_offset"` parameter in the exchange section of your configuration to adjust for this delay.
|
||||||
```
|
Example based on the above configuration:
|
||||||
# # Check if dataframe is out of date
|
|
||||||
# signal_date = arrow.get(latest['date'])
|
|
||||||
# interval_minutes = constants.TICKER_INTERVAL_MINUTES[interval]
|
|
||||||
# if signal_date < (arrow.utcnow().shift(minutes=-(interval_minutes * 2 + 5))):
|
|
||||||
# logger.warning(
|
|
||||||
# 'Outdated history for pair %s. Last tick is %s minutes old',
|
|
||||||
# pair,
|
|
||||||
# (arrow.utcnow() - signal_date).seconds // 60
|
|
||||||
# )
|
|
||||||
# return False, False
|
|
||||||
```
|
|
||||||
|
|
||||||
Or inrease the timeout to offer a level of protection/alignment of this test to freqtrade in live.
|
```json
|
||||||
|
"exchange": {
|
||||||
As example, to allow an additional 30 minutes. "(interval_minutes * 2 + 5 + 30)"
|
"name": "gdax",
|
||||||
```
|
"sandbox": true,
|
||||||
# Check if dataframe is out of date
|
"key": "5wowfxemogxeowo;heiohgmd",
|
||||||
signal_date = arrow.get(latest['date'])
|
"secret": "/ZMH1P62rCVmwefewrgcewX8nh4gob+lywxfwfxwwfxwfNsH1ySgvWCUR/w==",
|
||||||
interval_minutes = constants.TICKER_INTERVAL_MINUTES[interval]
|
"password": "1bkjfkhfhfu6sr",
|
||||||
if signal_date < (arrow.utcnow().shift(minutes=-(interval_minutes * 2 + 5 + 30))):
|
"outdated_offset": 30
|
||||||
logger.warning(
|
"pair_whitelist": [
|
||||||
'Outdated history for pair %s. Last tick is %s minutes old',
|
"BTC/USD"
|
||||||
pair,
|
|
||||||
(arrow.utcnow() - signal_date).seconds // 60
|
|
||||||
)
|
|
||||||
return False, False
|
|
||||||
```
|
```
|
@ -145,7 +145,8 @@ CONF_SCHEMA = {
|
|||||||
'pattern': '^[0-9A-Z]+/[0-9A-Z]+$'
|
'pattern': '^[0-9A-Z]+/[0-9A-Z]+$'
|
||||||
},
|
},
|
||||||
'uniqueItems': True
|
'uniqueItems': True
|
||||||
}
|
},
|
||||||
|
'outdated_offset': {'type': 'integer', 'minimum': 1}
|
||||||
},
|
},
|
||||||
'required': ['name', 'key', 'secret', 'pair_whitelist']
|
'required': ['name', 'key', 'secret', 'pair_whitelist']
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,8 @@ class IStrategy(ABC):
|
|||||||
# Check if dataframe is out of date
|
# Check if dataframe is out of date
|
||||||
signal_date = arrow.get(latest['date'])
|
signal_date = arrow.get(latest['date'])
|
||||||
interval_minutes = constants.TICKER_INTERVAL_MINUTES[interval]
|
interval_minutes = constants.TICKER_INTERVAL_MINUTES[interval]
|
||||||
if signal_date < (arrow.utcnow().shift(minutes=-(interval_minutes * 2 + 5))):
|
offset = self.config.get('outdated_offset', 5)
|
||||||
|
if signal_date < (arrow.utcnow().shift(minutes=-(interval_minutes * 2 + offset))):
|
||||||
logger.warning(
|
logger.warning(
|
||||||
'Outdated history for pair %s. Last tick is %s minutes old',
|
'Outdated history for pair %s. Last tick is %s minutes old',
|
||||||
pair,
|
pair,
|
||||||
|
Loading…
Reference in New Issue
Block a user