Questions tagged [ccxt]

The CCXT library is used to connect & trade with cryptocurrency / altcoin exchanges & payment processing services worldwide. It provides quick access to market data for storage, analysis, visualization, indicator development, algorithmic trading, strategy backtesting, bot programming, webshop integration and related software engineering. Use with topics related to the CCXT library which unifies a vast amount of crypto exchange APIs into one.

The CCXT library is used to connect and trade with cryptocurrency / altcoin exchanges and payment processing services worldwide. It provides quick access to market data for storage, analysis, visualization, indicator development, algorithmic trading, strategy backtesting, bot programming, webshop integration and related software engineering.

It is intended to be used by coders, developers, technically-skilled traders, data-scientists and financial analysts for building trading algorithms on top of it.

217 questions
13
votes
2 answers

Python unit test failed because of StopIteration error from Mock

I am testing a class object using mock which is ccxt.binance. This mocked object is passed as an argument to a function that I am testing. Initially it is working because I was able to test to up to a certain extent. However, when I changed a value…
cddventura
  • 131
  • 1
  • 1
  • 5
13
votes
1 answer

Where do I catch the KeyboardInterrupt exception in this async setup

I am working on a project that uses the ccxt async library which requires all resources used by a certain class to be released with an explicit call to the class's .close() coroutine. I want to exit the program with ctrl+c and await the close…
iuvbio
  • 600
  • 6
  • 23
12
votes
5 answers

How to make a binance futures order with ccxt in python?

How can I place a market order in ccxt for binance futures? Trading on binance futures with ccxt is already implemented https://github.com/ccxt/ccxt/pull/5907 In this post they suggest to use this line of code: let binance_futures = new…
eetiaro
  • 342
  • 1
  • 3
  • 14
9
votes
1 answer

Close position Binance Futures with ccxt

I'm trying to close a position on Binance Futures using ccxt ccxt-1.39.93, Python 3. # fetch position position = binance.fetch_balance()['info']['positions'] pos = [p for p in position if p['symbol'] == "ETHUSDT"][0] ticker =…
kollo
  • 1,285
  • 3
  • 20
  • 33
9
votes
2 answers

How to place percentage orders with Binance API and Python-CCXT?

I'm playing with Binance API to make my trading bot with Python 3.6. and CCXT library (here you find the docs ). One very useful thing they have in their site is the capability to place orders for a percentage of your current balance: for example if…
kalikantus
  • 123
  • 1
  • 1
  • 6
7
votes
2 answers

How to get the price of a crypto at a given time in the past?

Is there any way I can use ccxt to extract the price of a crypto currency at a given time in the past? Example: get price of BTC on binance at time 2018-01-24 11:20:01
Orl13
  • 339
  • 4
  • 15
6
votes
1 answer

ValueError: Length of passed values is 7, index implies 0

I am trying to get 1minute open, high, low, close, volume values from bitmex using ccxt. everything seems to be fine however im not sure how to fix this error. I know that the index is 7 because there are 7 values in the OHLCcolumns that I am…
GSatterwhite
  • 301
  • 1
  • 3
  • 12
5
votes
1 answer

how to place a stop-buy order by ccxt in binance

I try to do that by codes below but I got error import ccxt # noqa: E402 import apiConfig exchange = ccxt.binance({ 'apiKey': apiConfig.API_KEY, 'secret': apiConfig.API_SECRET, 'enableRateLimit': True, }) symbol = 'RVN/USDT' type =…
kambiz
  • 51
  • 1
  • 3
4
votes
1 answer

CCXT ByBit Close Position

I am using ccxt to connect to ByBit and create orders. symbol = 'SOLUSDT' trade_res = exchange.create_order(symbol, amount=1, type='Market', side='Buy') The above snippet buys 1 SOL against USDT. When I try to close the position by placing a sell…
Mohammad Adam
  • 88
  • 1
  • 6
4
votes
1 answer

How to make a Kucoin futures order with ccxt in python?

The following code work binance futures using ccxt. What is the correct code/configuration for kucoin futures? import ccxt import pandas as pd binance = ccxt.binance() binance.options = {'defaultType': 'delivery', 'adjustForTimeDifference':…
Hawks
  • 71
  • 1
  • 2
4
votes
2 answers

CCXT okex5 swap contracts - Parameter posSide error

I am trying to create a perpetual limit order using ccxt on okex exchange version 5. The API is successfully placing orders(both limit and market) on spot exchange but not on perpetual exchange. Here is what I am trying - exchange_swap =…
4
votes
1 answer

CCXT - Create a market order by only specifying quote currency amount

From what I have seen CCXT does not provide functionality for creating an order of type: "I want to spend 10 USDT to buy BTC" Instead, the only thing you can do is to specify the amount of the base currency(BTC) you want to buy, like in the…
Pmits
  • 165
  • 1
  • 4
  • 17
4
votes
1 answer

how to tell ccxt to use binance / bybit testnet

i wrote a small script to download ohlcv data from binance or bybit with ccxt. I want to get candle data from the testnet as well as the main net. I looked at ccxt code and there are urls for both nets, yet i do not know how to set the option. I…
stdout
  • 79
  • 1
  • 6
3
votes
2 answers

BTC Price Across Different Crypto Exchanges

I am trying to use CCXT to get the BTC bid and ask price across different exchanges, but running the code sequencially cannot get the price of a given moment correctly. Is there any way to execute them at the same time and return the correct…
3
votes
1 answer

Binance error - Too much request weight used; current limit is 1200 request weight per 1 MINUTE

exchange.load_markets() while 1: try: bars = exchange.fetch_ohlcv(ETH/USDT, timeframe='5m', limit=5) df = pd.DataFrame(bars[:], columns=['timestamp', 'open', 'high', 'low', 'close',…
euphrates85
  • 87
  • 1
  • 8
1
2 3
14 15