Skip to content

Commit

Permalink
a bit refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
alifanov committed Sep 2, 2017
1 parent b722575 commit 33ccfec
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import hmac
import hashlib

from config import API_KEY, API_SECRET
from urllib.parse import urlencode

CHUNK = 50
DEPTH_LIMIT = 20
MAX_TRADE_BTC = 0.0005
CHECK_DELAY = 5.0

from config import API_KEY, API_SECRET
from urllib.parse import urlencode


class YobitAPI:
def __init__(self, key, secret):
Expand Down Expand Up @@ -116,16 +116,16 @@ def check_pairs(yo):
next_ask_volume = depth[pair]['asks'][1][1]

if stat['mean_volume'] * 10 >= ask_volume and ask_volume < next_ask_volume:
trade_volume = min(ask_volume, 1.0*MAX_TRADE_BTC/ask_price)
trade_volume = min(ask_volume, 1.0 * MAX_TRADE_BTC / ask_price)
if trade_volume:
if '_btc' in pair:
if ask_price*trade_volume <= MAX_TRADE_BTC:
if ask_price * trade_volume <= MAX_TRADE_BTC:
print('Open trade: ', pair, trade_volume, ask_price, next_ask_price)
print('Pair: ', pair)
print('Trade volume: ', trade_volume)
print('Buy price: ', ask_price)
print('Sell price: ', next_ask_price)
print('Profit: ', (next_ask_price - ask_price)*trade_volume)
print('Profit: ', (next_ask_price - ask_price) * trade_volume)
print()
yo.open_trade(pair, ask_price, next_ask_price, trade_volume)

Expand Down

0 comments on commit 33ccfec

Please sign in to comment.