CCXT – A JavaScript / Python / PHP cryptocurrency trading API with support for more than 120 bitcoin/altcoin exchanges
@hivemall
You want to use implicit API methods as described in the Manual:
where to find this api call? https://binance-docs.github.io/apidocs/spot/en/#exchange-information
You can find it here among implicit API methods: https://github.com/ccxt/ccxt/blob/master/js/binance.js#L206
The same endpoint is used to load exchange markets from Binance.
In Python calling that explicit method is done like so:
exchange.public_get_exchangeinfo()
exchange.publicGetExchangeInfo()
exchange.loadMarkets() // this will call the same endpoint internally anyway
and which one for trex to check the status shown here: https://global.bittrex.com/Status
It's the same story, you need another implicit method: https://github.com/ccxt/ccxt/blob/master/js/bittrex.js#L117
exchange.v2_get_currencies_getwallethealth()
exchange.v2GetCurrenciesGetWalletHealth()
Q3: how to check market: is btc/usdt active
Use the active
flag inside the markets:
exchange.load_markets()
print(exchange.markets['BTC/USDT']['active'])
Hello all, I'm here cause I'd like to add exchange functionality for the SafeTrade Exchange. It's been a long time since I did any JS development, so it's going to be a challenge. The exchange in question is a fork of a project called Peatio, and I was hoping that there may be some other Peatio-derived exchanges already in the library that I could borrow from.
Anyways, I'm going to be spending some time figuring out how to testing and debugging in IntelliJ. I've already got the Docker image running and have been reading over ccxt contribution docs a lot. Thanks for any suggestions.
@daHIFI_gitlab hi and welcome! )
I would highly recommend reading through the CONTRIBUTING guidelines very carefully, that will save you a lot of time. In particular:
In general, it may not be too easy to develop a complete integration from scratch, so I will also suggest looking into how things are done with the other exchanges as well. If you represent SafeTrade or if you are affiliated with the exchange it is also possible to hire the CCXT Dev Team to do the job for you on a commercial basis. That will of course depend on the underlying API and other factors. If that is something you would be interested in – feel free to reach out to me directly at igor@ccxt.trade.
Don't hesitate if you have any questions
import ccxt
#BYTETRADE:
exchange = ccxt.bytetrade ({ #ccxt.exchanges
'rateLimit': 10000,
'options': {
'adjustForTimeDifference': False,
}
})
markets = exchange.load_markets()
#(Loaded keys)
exchange.apiKey = 'xxxxxxx'
exchange.secret = 'xxxxxxxx'
#Trade:
exchange.create_market_sell_order('ETH/USDT', 0.0045)
---------------------------------------------------------------------------
InvalidOperation Traceback (most recent call last)
<ipython-input-33-2b75401ec67e> in <module>
----> 1 exchange.create_market_sell_order('ETH/USDT', 0.0045)
~\Anaconda3\envs\Python3.6Test\lib\site-packages\ccxt\base\exchange.py in create_market_sell_order(self, symbol, amount, params)
1741
1742 def create_market_sell_order(self, symbol, amount, params={}):
-> 1743 return self.create_order(symbol, 'market', 'sell', amount, None, params)
1744
1745 def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
~\Anaconda3\envs\Python3.6Test\lib\site-packages\ccxt\bytetrade.py in create_order(self, symbol, type, side, amount, price, params)
551 quoteId = market['quoteId']
552 quoteCurrency = self.currency(market['quote'])
--> 553 priceRounded = self.price_to_precision(symbol, price)
554 priceChain = self.toWei(priceRounded, 'ether', quoteCurrency['precision']['amount'])
555 now = self.milliseconds()
~\Anaconda3\envs\Python3.6Test\lib\site-packages\ccxt\base\exchange.py in price_to_precision(self, symbol, price)
1200
1201 def price_to_precision(self, symbol, price):
-> 1202 return self.decimal_to_precision(price, ROUND, self.markets[symbol]['precision']['price'], self.precisionMode)
1203
1204 def amount_to_precision(self, symbol, amount):
~\Anaconda3\envs\Python3.6Test\lib\site-packages\ccxt\base\decimal_to_precision.py in decimal_to_precision(n, rounding_mode, precision, counting_mode, padding_mode)
53 context.rounding = decimal.ROUND_HALF_UP # rounds 0.5 away from zero
54
---> 55 dec = decimal.Decimal(str(n))
56 precision_dec = decimal.Decimal(str(precision))
57 string = '{:f}'.format(dec) # convert to string using .format to avoid engineering notation
InvalidOperation: [<class 'decimal.ConversionSyntax'>]
create_order
instead of create_market_sell_order
with a specified price?symbol = 'ETH/USDT'
ticker = exchange.fetch_ticker(symbol)
price = ticker['high']
# --------------------------------- ↓ market sell with a price ↓
exchange.create_order('ETH/USDT', 'market', 'sell', 0.0045, price)
---------------------------------------------------------------------------
Error Traceback (most recent call last)
<ipython-input-4-d5d8de860aca> in <module>
2 ticker = exchange.fetch_ticker(symbol)
3 price = ticker['high']
----> 4 exchange.create_order('ETH/USDT','market', 'sell', 0.0045, price)
~\Anaconda3\envs\Python3.6Test\lib\site-packages\ccxt\bytetrade.py in create_order(self, symbol, type, side, amount, price, params)
637 bytestring = self.binary_concat_array(allByteStringArray)
638 hash = self.hash(bytestring, 'sha256', 'hex')
--> 639 signature = self.ecdsa(hash, self.secret, 'secp256k1', None, True)
640 recoveryParam = self.decode(base64.b16encode(self.numberToLE(self.sum(signature['v'], 31), 1)))
641 mySignature = recoveryParam + signature['r'] + signature['s']
~\Anaconda3\envs\Python3.6Test\lib\site-packages\ccxt\base\exchange.py in ecdsa(request, secret, algorithm, hash, fixed_length)
1104 digest = base64.b16decode(encoded_request, casefold=True)
1105 key = ecdsa.SigningKey.from_string(base64.b16decode(Exchange.encode(secret),
-> 1106 casefold=True), curve=curve_info[0])
1107 r_binary, s_binary, v = key.sign_digest_deterministic(digest, hashfunc=hash_function,
1108 sigencode=ecdsa.util.sigencode_strings_canonize)
~\Anaconda3\envs\Python3.6Test\lib\base64.py in b16decode(s, casefold)
265 s = s.upper()
266 if re.search(b'[^0-9A-F]', s):
--> 267 raise binascii.Error('Non-base16 digit found')
268 return binascii.unhexlify(s)
269
Error: Non-base16 digit found
Has any pricing information been released yet?
The pricing is very close to this: https://github.com/ccxt/ccxt/issues/56#issuecomment-527194069
I am still a student, hoping for an affordable price
If you take part in developing and supporting it after the release – you can get a free CCXT bRO license.