Skip to content

Commit

Permalink
add Kraken specifics
Browse files Browse the repository at this point in the history
  • Loading branch information
Crypto God committed Feb 15, 2019
1 parent 018cee8 commit ef5a0b9
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 12 deletions.
71 changes: 71 additions & 0 deletions config_kraken.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"max_open_trades": 5,
"stake_currency": "EUR",
"stake_amount": 10,
"fiat_display_currency": "EUR",
"ticker_interval" : "5m",
"dry_run": true,
"db_url": "sqlite:///tradesv3.dryrun.sqlite",
"trailing_stop": false,
"unfilledtimeout": {
"buy": 10,
"sell": 30
},
"bid_strategy": {
"ask_last_balance": 0.0,
"use_order_book": false,
"order_book_top": 1,
"check_depth_of_market": {
"enabled": false,
"bids_to_ask_delta": 1
}
},
"ask_strategy":{
"use_order_book": false,
"order_book_min": 1,
"order_book_max": 9
},
"exchange": {
"name": "kraken",
"key": "",
"secret": "",
"ccxt_config": {"enableRateLimit": true},
"ccxt_async_config": {
"enableRateLimit": true,
"rateLimit": 3000
},
"pair_whitelist": [
"ETH/EUR",
"BTC/EUR",
"BCH/EUR"
],
"pair_blacklist": [

]
},
"edge": {
"enabled": false,
"process_throttle_secs": 3600,
"calculate_since_number_of_days": 7,
"capital_available_percentage": 0.5,
"allowed_risk": 0.01,
"stoploss_range_min": -0.01,
"stoploss_range_max": -0.1,
"stoploss_range_step": -0.01,
"minimum_winrate": 0.60,
"minimum_expectancy": 0.20,
"min_trade_number": 10,
"max_trade_duration_minute": 1440,
"remove_pumps": false
},
"telegram": {
"enabled": false,
"token": "",
"chat_id": ""
},
"initial_state": "running",
"forcebuy_enable": false,
"internals": {
"process_throttle_secs": 5
}
}
34 changes: 22 additions & 12 deletions freqtrade/exchange/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,14 @@ def buy(self, pair: str, ordertype: str, amount: float,
amount = self.symbol_amount_prec(pair, amount)
rate = self.symbol_price_prec(pair, rate) if ordertype != 'market' else None

if time_in_force == 'gtc':
return self._api.create_order(pair, ordertype, 'buy', amount, rate)
else:
return self._api.create_order(pair, ordertype, 'buy',
amount, rate, {'timeInForce': time_in_force})
params = {}
if time_in_force != 'gtc':
params.update({'timeInForce': time_in_force})
if self.id == "kraken":
params.update({"trading_agreement": "agree"})

return self._api.create_order(pair, ordertype, 'buy',
amount, rate, params)

except ccxt.InsufficientFunds as e:
raise DependencyException(
Expand Down Expand Up @@ -347,11 +350,14 @@ def sell(self, pair: str, ordertype: str, amount: float,
amount = self.symbol_amount_prec(pair, amount)
rate = self.symbol_price_prec(pair, rate) if ordertype != 'market' else None

if time_in_force == 'gtc':
return self._api.create_order(pair, ordertype, 'sell', amount, rate)
else:
return self._api.create_order(pair, ordertype, 'sell',
amount, rate, {'timeInForce': time_in_force})
params = {}
if time_in_force != 'gtc':
params.update({'timeInForce': time_in_force})
if self.id == "kraken":
params.update({"trading_agreement": "agree"})

return self._api.create_order(pair, ordertype, 'sell',
amount, rate, params)

except ccxt.InsufficientFunds as e:
raise DependencyException(
Expand Down Expand Up @@ -403,8 +409,12 @@ def stoploss_limit(self, pair: str, amount: float, stop_price: float, rate: floa
return self._dry_run_open_orders[order_id]

try:
params = {'stopPrice': stop_price}
if self.id == "kraken":
params.update({"trading_agreement": "agree"})

order = self._api.create_order(pair, 'stop_loss_limit', 'sell',
amount, rate, {'stopPrice': stop_price})
amount, rate, params)
logger.info('stoploss limit order added for %s. '
'stop price: %s. limit: %s' % (pair, stop_price, rate))
return order
Expand Down Expand Up @@ -546,7 +556,7 @@ def refresh_latest_ohlcv(self, pair_list: List[Tuple[str, str]]) -> List[Tuple[s
interval_in_sec = constants.TICKER_INTERVAL_MINUTES[ticker_interval] * 60

if not ((self._pairs_last_refresh_time.get((pair, ticker_interval), 0)
+ interval_in_sec) >= arrow.utcnow().timestamp
+ interval_in_sec) >= arrow.utcnow().timestamp
and (pair, ticker_interval) in self._klines):
input_coroutines.append(self._async_get_candle_history(pair, ticker_interval))
else:
Expand Down

0 comments on commit ef5a0b9

Please sign in to comment.