Tag Archives: Trading harmonic patterns talk video playback 

MbM Crypto Trading Track Record Profit and Loss 24/04/2019 07:44:43

Login to get your latest Crypto Trading Track Record P&L from prior trading day

MbM Crypto Trading Track Record Profit and Loss 23/04/2019 23:55:33

Login to get your latest Crypto Trading Track Record P&L from prior trading day

Webinar on Binance API trading

Webinar on Binance API trading

Continue reading

MbM Crypto Trading Track Record Profit and Loss 22/04/2019 23:57:26

Login to get your latest Crypto Trading Track Record P&L from prior trading day

MbM Crypto Trading Track Record Profit and Loss 22/04/2019 23:55:09

Login to get your latest Crypto Trading Track Record P&L from prior trading day

MbM Crypto Trading Track Record Profit and Loss 21/04/2019 23:55:11

Login to get your latest Crypto Trading Track Record P&L from prior trading day

MbM Crypto Trading Track Record Profit and Loss 20/04/2019 23:55:12

Login to get your latest Crypto Trading Track Record P&L from prior trading day

MORE Fun with Binance CCXT API trading

More helpful links

This continues from https://quantlabs.net/academy/fun-with-binance-ccxt-api-trading/

This example uses BNB/BTC which I am using

 

https://github.com/ccxt/ccxt/issues/2552

https://github.com/DeviaVir/zenbot/issues/876

Note problem:

i currently am encountering the same issue and have enough funds to cover the trade. i believe this is an issue with binance’s api. has anyone figured out a way around it?

Read SoftMandar comment Note that this qas suggested using with reason posted

new_quantity = int(quantity – (0.050*quantity)/100).Good luck :>.

read glennfu commment I have seen this where orders are place via CCXT with exceptions thrown but orders are still placed. Please watch and verify this in your initial testing.

https://github.com/DeviaVir/zenbot/issues/876

Note cost_to_precision() can be issue as well

https://github.com/ccxt/ccxt/issues/846

https://github.com/ccxt/ccxt/issues/2552 ← THIS ANSWERS MANY DEBUGGING QUERIES

Note how ccxt author runs to test pair:

python3 examples/py/cli.py binance market BNB/BTC

As a result, do run when needed but ensure you run from the latest Git cloned ccxt repository.

Just clone by running:

git clone it clone https://github.com/ccxt/ccxt.git

NEW BUY TEST

typ = ‘market’ #’limit’ # or ‘market’

side = ‘buy’ # or ‘buy’

symbol = ‘XRP/BTC’

qty = 200 #qty

new_quantity = int(qty – (0.050*qty)/100) #https://github.com/DeviaVir/zenbot/issues/876

amount = new_quantity

order working result

{‘info’: {‘symbol’: ‘XRPBTC’, ‘orderId’:, ‘clientOrderId’: , ‘transactTime’: 1555787612841, ‘price’: ‘0.00000000’, ‘origQty’: ‘199.00000000’, ‘executedQty’: ‘199.00000000’, ‘cummulativeQuoteQty’: ‘0.01236984’, ‘status’: ‘FILLED’, ‘timeInForce’: ‘GTC’, ‘type’: ‘MARKET’, ‘side’: ‘BUY’, ‘fills’: [{‘price’: ‘0.00006216’, ‘qty’: ‘199.00000000’, ‘commission’: ‘0.00200527’, ‘commissionAsset’: ‘BNB’, ‘tradeId’:}]}, ‘id’: ”, ‘timestamp’: 1555787612841, ‘datetime’: ‘2019-04-20T19:13:32.841Z’, ‘lastTradeTimestamp’: None, ‘symbol’: ‘XRP/BTC’, ‘type’: ‘market’, ‘side’: ‘buy’, ‘price’: 6.216e-05, ‘amount’: 199.0, ‘cost’: 0.01236984, ‘average’: 6.216e-05, ‘filled’: 199.0, ‘remaining’: 0.0, ‘status’: ‘closed’, ‘fee’: {‘cost’: 0.00200527, ‘currency’: ‘BNB’}, ‘trades’: [{‘info’: {‘price’: ‘0.00006216’, ‘qty’: ‘199.00000000’, ‘commission’: ‘0.00200527’, ‘commissionAsset’: ‘BNB’, ‘tradeId’:}, ‘timestamp’: None, ‘datetime’: None, ‘symbol’: ‘XRP/BTC’, ‘id’: None, ‘order’: None, ‘type’: None, ‘takerOrMaker’: None, ‘side’: None, ‘price’: 6.216e-05, ‘amount’: 199.0, ‘cost’: 0.01236984, ‘fee’: {‘cost’: 0.00200527, ‘currency’: ‘BNB’}}]}

Binance.com trade history verified:

Date Pair Type Price Filled Fee Total
2019-04-20 15:13:32 XRP/BTC Buy 0.00006216 199 0.00200527 BNB 0.01236984 BTC

Traded 0.01236984 BTC to 65.77 usd

SELL TEST

ymbol = ‘BNB/BTC’

typ = ‘market’ #’limit’ # or ‘market’

side = ‘sell’ # or ‘buy’

#note that this works! typ=’market’ side=’buy’ symbol = ‘BNB/BTC’ amount = 5 #qty price = 0.01

ctp=exchange.cost_to_precision(symbol,cl)

symbol = ‘XRP/BTC’

qty = 200 #qty

new_quantity = int(qty – (0.050*qty)/100) #https://github.com/DeviaVir/zenbot/issues/876

amount = new_quantity

order result is

Binance.com trade report

ate Pair Type Price Filled Fee Total
2019-04-20 15:18:11 XRP/BTC Sell 0.00006211 199 0.00200323 BNB 0.01235989 BTC
2019-04-20 15:13:32 XRP/BTC Buy 0.00006216 199 0.00200527 BNB 0.01236984 BTC

Result is 0.01235989 BTC to 65.72 usd

NOW SCALE DOWN ORDER BY 1/10 to Quantity/Amount 20

working order result

Binance.com trading history

Date Pair Type Price Filled Fee Total
2019-04-20 15:22:09 XRP/BTC Buy 0.00006212 19 0.00019100 BNB 0.00118028 BTC

0.00118028 BTC to 6.28 usd ←-LOWER RISK TEST TRADE

SELL 20

{‘info’: {‘symbol’: ‘XRPBTC’, ‘orderId’:, ‘clientOrderId’: ”, ‘transactTime’: 1555788289202, ‘price’: ‘0.00000000’, ‘origQty’: ‘19.00000000’, ‘executedQty’: ‘19.00000000’, ‘cummulativeQuoteQty’: ‘0.00117971’, ‘status’: ‘FILLED’, ‘timeInForce’: ‘GTC’, ‘type’: ‘MARKET’, ‘side’: ‘SELL’, ‘fills’: [{‘price’: ‘0.00006209’, ‘qty’: ‘19.00000000’, ‘commission’: ‘0.00019108’, ‘commissionAsset’: ‘BNB’, ‘tradeId’:}]}, ‘id’: ”, ‘timestamp’: 1555788289202, ‘datetime’: ‘2019-04-20T19:24:49.202Z’, ‘lastTradeTimestamp’: None, ‘symbol’: ‘XRP/BTC’, ‘type’: ‘market’, ‘side’: ‘sell’, ‘price’: 6.209e-05, ‘amount’: 19.0, ‘cost’: 0.00117971, ‘average’: 6.209e-05, ‘filled’: 19.0, ‘remaining’: 0.0, ‘status’: ‘closed’, ‘fee’: {‘cost’: 0.00019108, ‘currency’: ‘BNB’}, ‘trades’: [{‘info’: {‘price’: ‘0.00006209’, ‘qty’: ‘19.00000000’, ‘commission’: ‘0.00019108’, ‘commissionAsset’: ‘BNB’, ‘tradeId’:}, ‘timestamp’: None, ‘datetime’: None, ‘symbol’: ‘XRP/BTC’, ‘id’: None, ‘order’: None, ‘type’: None, ‘takerOrMaker’: None, ‘side’: None, ‘price’: 6.209e-05, ‘amount’: 19.0, ‘cost’: 0.00117971, ‘fee’: {‘cost’: 0.00019108, ‘currency’: ‘BNB’}}]}

Binance.com trading history

Date Pair Type Price Filled Fee Total
2019-04-20 15:24:49 XRP/BTC Sell 0.00006209 19 0.00019108 BNB 0.00117971 BTC
2019-04-20 15:22:09 XRP/BTC Buy 0.00006212 19 0.00019100 BNB 0.00118028 BTC

0.00117971 BTC to 6.29 usd

**** CURRENT MARKET MINIMUM IS 0.001 btc to 5.32 usd

NOW SCALE DOWN ORDER BY Quantity/Amount=10

which did not meet minimum

ccxt.base.errors.InvalidOrder: binance {“code”:-1013,”msg”:”Filter failure: MIN_NOTIONAL”}

\

NOW Let”s test XRP/ETH (in Ethererum)

So 50 XRP/ETH is 0.095 ETH which > 0.01 minimum

So 25 XRP/ETH is 0.0475 ETH which > 0.01 minimum

typ = ‘market’ #’limit’ # or ‘market’

side = ‘buy’ # or ‘buy’

symbol = ‘XRP/ETH’

qty = 25 #qty

new_quantity = int(qty – (0.050*qty)/100) #https://github.com/DeviaVir/zenbot/issues/876

amount = new_quantity

price = 0.01

order = exchange.create_order(symbol, typ, side, amount, params)

exception

ccxt.base.errors.InvalidOrder: binance {“code”:-1013,”msg”:”Filter failure: MIN_NOTIONAL”}

Change quantity/amount to 50

ccxt.base.errors.InsufficientFunds: binance Account has insufficient balance for requested action.

So do I buy certain amount of ETH in BTC to ensure amount ?

1 eth/btc is 0.03 or $172.7 usd

typ = ‘market’ #’limit’ # or ‘market’

side = ‘buy’ # or ‘buy’

#note that this works! typ=’market’ side=’buy’ symbol = ‘BNB/BTC’ amount = 5 #qty price = 0.01

ctp=exchange.cost_to_precision(symbol,cl)

#symbol = ‘XRP/ETH’

symbol = ‘ETH/BTC’

qty = 1 #qty

new_quantity = int(qty – (0.050*qty)/100) #https://github.com/DeviaVir/zenbot/issues/876

amount = new_quantity

Excepton: ccxt.base.errors.InvalidOrder: binance {“code”:-1013,”msg”:”Invalid quantity.”}

amount = 1.0 #new_quantity

Notteto use 1.0 not 1 for amount

Order result

{‘info’: {‘symbol’: ‘ETHBTC’, ‘orderId’:, ‘clientOrderId’: ”, ‘transactTime’: 1555789625102, ‘price’: ‘0.00000000’, ‘origQty’: ‘1.00000000’, ‘executedQty’: ‘1.00000000’, ‘cummulativeQuoteQty’: ‘0.03259145’, ‘status’: ‘FILLED’, ‘timeInForce’: ‘GTC’, ‘type’: ‘MARKET’, ‘side’: ‘BUY’, ‘fills’: [{‘price’: ‘0.03259100’, ‘qty’: ‘0.54100000’, ‘commission’: ‘0.00285487’, ‘commissionAsset’: ‘BNB’, ‘tradeId’:}, {‘price’: ‘0.03259200’, ‘qty’: ‘0.45900000’, ‘commission’: ‘0.00242215’, ‘commissionAsset’: ‘BNB’, ‘tradeId’:}]}, ‘id’: ”, ‘timestamp’: 1555789625102, ‘datetime’: ‘2019-04-20T19:47:05.102Z’, ‘lastTradeTimestamp’: None, ‘symbol’: ‘ETH/BTC’, ‘type’: ‘market’, ‘side’: ‘buy’, ‘price’: 0.03259145, ‘amount’: 1.0, ‘cost’: 0.032591459, ‘average’: 0.032591459, ‘filled’: 1.0, ‘remaining’: 0.0, ‘status’: ‘closed’, ‘fee’: {‘cost’: 0.00527702, ‘currency’: ‘BNB’}, ‘trades’: [{‘info’: {‘price’: ‘0.03259100’, ‘qty’: ‘0.54100000’, ‘commission’: ‘0.00285487’, ‘commissionAsset’: ‘BNB’, ‘tradeId’:}, ‘timestamp’: None, ‘datetime’: None, ‘symbol’: ‘ETH/BTC’, ‘id’: None, ‘order’: None, ‘type’: None, ‘takerOrMaker’: None, ‘side’: None, ‘price’: 0.032591, ‘amount’: 0.541, ‘cost’: 0.017631731, ‘fee’: {‘cost’: 0.00285487, ‘currency’: ‘BNB’}}, {‘info’: {‘price’: ‘0.03259200’, ‘qty’: ‘0.45900000’, ‘commission’: ‘0.00242215’, ‘commissionAsset’: ‘BNB’, ‘tradeId’: 118495802}, ‘timestamp’: None, ‘datetime’: None, ‘symbol’: ‘ETH/BTC’, ‘id’: None, ‘order’: None, ‘type’: None, ‘takerOrMaker’: None, ‘side’: None, ‘price’: 0.032592, ‘amount’: 0.459, ‘cost’: 0.014959728000000002, ‘fee’: {‘cost’: 0.00242215, ‘currency’: ‘BNB’}}]}

Note new acount balance updated with proper ETH Account balance

get balance snippey

{‘info’: {‘makerCommission’: 10, ‘takerCommission’: 10, ‘buyerCommission’: 0, ‘sellerCommission’: 0, ‘canTrade’: True, ‘canWithdraw’: True, ‘canDeposit’: True, ‘updateTime’: 1555789625102, ‘accountType’: ‘MARGIN’, ‘balances’: [{‘asset’: ‘BTC’, ‘free’: ‘0.03726609’, ‘locked’: ‘0.00000000’}, {‘asset’: ‘LTC’, ‘free’: ‘0.00000000’, ‘locked’: ‘0.00000000’}, {‘asset’: ‘ETH’, ‘free’: ‘1.00000000’, ‘locked’: ‘0.00000000’}, {…..

Binance.com trade history

Date Pair Type Price Filled Fee Total
2019-04-20 15:47:05 ETH/BTC Buy 0.032592 0.459 0.00242215 BNB 0.01495972 BTC
2019-04-20 15:47:05 ETH/BTC Buy 0.032591 0.541 0.00285487 BNB 0.01763173 BTC

Fee of 0.00242215 Binance Coin is 0.059593 US Dollar.

So let’s test now XRP/ETH

So 10 XRP/ETH is 0.018 ETH which > 0.01 minimum

symbol = ‘BNB/BTC’

typ = ‘market’ #’limit’ # or ‘market’

side = ‘buy’ # or ‘buy’

#note that this works! typ=’market’ side=’buy’ symbol = ‘BNB/BTC’ amount = 5 #qty price = 0.01

ctp=exchange.cost_to_precision(symbol,cl)

#symbol = ‘XRP/ETH’

symbol = ‘XRP/ETH’

qty = 10 #qty

new_quantity = int(qty – (0.050*qty)/100) #https://github.com/DeviaVir/zenbot/issues/876

amount = new_quantity

which did not meet minimum

ccxt.base.errors.InvalidOrder: binance {“code”:-1013,”msg”:”Filter failure: MIN_NOTIONAL”}

\

typ = ‘market’ #’limit’ # or ‘market’

side = ‘buy’ # or ‘buy’

symbol = ‘XRP/ETH’

qty = 25 #qty

new_quantity = int(qty – (0.050*qty)/100) #https://github.com/DeviaVir/zenbot/issues/876

amount = new_quantity

price = 0.01

Order is

Binance.com trading history

Date Pair Type Price Filled Fee Total
2019-04-20 15:57:13 XRP/ETH Buy 0.00189910 9 0.00009011 BNB 0.01709190 ETH

Sell 10 XRP/ETH

‘cost’: 0.01708434, ‘fee’: {‘cost’: 9.004e-05, ‘currency’: ‘BNB’}}]}

Binance.com trade history

Date Pair Type Price Filled Fee Total
2019-04-20 16:00:45 XRP/ETH Sell 0.00189826 9 0.00009004 BNB 0.01708434 ETH
2019-04-20 15:57:13 XRP/ETH Buy 0.00189910 9 0.00009011 BNB 0.01709190 ETH

0.01708434 Ether equals

2.96 United States Dollar

0.0170919 Ether equals

2.96 United States Dollar

Broke even on XRP/ETH trade!!

Sample Python script to test for minimum XRP in ETH

#ttps://github.com/ccxt/ccxt/blob/master/examples/py/binance-test-order.pyh
import os
import sys
import pandas as pd

root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + ‘/python’)

import ccxt # noqa: E402

MIN_ETH = 0.01
MIN_BTC = 0.0001

os.system(‘python3 ccxt_market_data2.py -e binance -s XRP/ETH -t 1m’)
df = pd.read_csv(‘binance-XRPETH-1m.csv’)
row = df.tail(1)
#round up +1 once the minimum quantityis caculated
cl = float(row.Close.values)
qty = (cl/MIN_ETH)*100.0
print(qty)
print(cl)
input(‘press a key…’)

exchange = ccxt.binance({
‘apiKey’: ‘xx’,
‘secret’: ‘xx’,
‘enableRateLimit’: True,
})

print(‘get balance’)
print(exchange.fetch_balance())

symbol = ‘XRP/ETH’
typ = ‘market’ #’limit’ # or ‘market’
side = ‘buy’

amount = qty

params = {
‘test’: True, #False, # test if it’s valid, but don’t actually place it
}

order = exchange.create_order(symbol, typ, side, amount, params)
print(order)

MbM Crypto Trading Track Record Profit and Loss 19/04/2019 23:55:21

Login to get your latest Crypto Trading Track Record P&L from prior trading day

MbM Crypto Trading Track Record Profit and Loss 18/04/2019 23:55:12

Login to get your latest Crypto Trading Track Record P&L from prior trading day