Comments (3)
And yeah, lack of price isn't clear enough to make it market order; this is a bug waiting to happen. Instead, have parameter type='market' or type='limit' to differentiate between those two.
from ccxt.
The reason for having a huge variety of method signatures was to ease the integration into existing projects, where other libraries may have existed previously with all their different flavours and syntaxes. That load of methods was added to allow code hot-swapping in existing logic. This way it would not require too much in-place rewriting to plug this library into a paper trading strategy or into a fast prototype of a bot.
Yet still, I agree completely, there's a potential pitfall for those who are not careful enough. I will remove excessive methods to minimize that.
What's the difference between this two?
order (symbol, side, amount[, price[, params]]) trade (symbol, side, amount[, price[, params]])
There's no difference, it's an alias, legacy, for same reasons, mentioned above. There are 3 methods with same signature but different names: createOrder == order == trade
. I will clean it up, of course.
Also is there any reason for keeping camelCase in python, instead of using only underscores? PEP8 standard defines how python code should look like, and I assume your users are using it; it's trivial converting camelCase to underscore in the head; much less trivial if there's a typo somewhere and you accidentally call the wrong function.
The reason for keeping both camelCaseNames and names_with_underscores is cross-compatibility, the ability to copy-paste between languages (or close to that, without too many significant changes). This helps interoperability among the community of the users of the library, who prefer different languages, but would still be able to understand each other.
The JS → Py/PHP transpiler currently does not convert internal public/private API calls to underscore-style inside method bodies. But I will finish the name conversion stage and all Python names will conform to PEP standards really soon, I hope.
And yeah, lack of price isn't clear enough to make it market order; this is a bug waiting to happen.
I'll make the price/ordertype more explicit and restrict the set of methods, thanks for pointing that out.
from ccxt.
Ok, I cleaned up the set of methods leaving only the following:
# Python
.create_market_buy_order (symbol, amount[, params])
.create_market_sell_order (symbol, amount[, params])
.create_limit_buy_order (symbol, amount, price[, params])
.create_limit_sell_order (symbol, amount, price[, params])
... and their camelCase aliases. Everything else is gone from now on, no typo-mistakes anymore )
I also left in place just one single generic create_order () method, but I will explicitly mention the risks of using it in the docs.
from ccxt.
Related Issues (20)
- I've been encountering this error with BingX since yesterday! Could you please help me with this? "file "/usr/local/lib/python3.9/dist-packages/ccxt/async_support/bingx.py", line 2967, in handle_errors code = self.safe_currency_code(currencyId, currency) ccxt.base.errors.ExchangeError: bingx {"code":80020,"msg":"risk forbidden","data":{}}" HOT 8
- Missing precision base/quote values in fetch/parse market HOT 3
- Incorrect output of the financing rate
- The withdraw method on Bithumb exchange is returning an error.
- setMarginMode not working on Binance HOT 1
- Tried all methods, still getting error HOT 1
- How can I specify type of order? HOT 2
- Phemex - BUG - Edit order can only change the price and not the size [contracts] HOT 1
- watch_multiple seems still have bug HOT 10
- Phemex - BUG - Symbol not required for fetch_my_trades [contracts] HOT 2
- bitopro websocket endpoint must be changed HOT 1
- gate fetch_leverage_tiers broken HOT 1
- How to check if API Key has trade permission? HOT 2
- Websockets break on any cloud server HOT 4
- Unable to query contract funds from Phemex HOT 6
- bitget watch_orderbook freeze (2) HOT 3
- sending market orders with USDT parameter? HOT 3
- The socket hangs on Bybit's watch_ohlcv HOT 6
- totalAvailableBalance returns empty string even if accountType is UNIFIED HOT 2
- Exchange Request: PowerTrade HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ccxt.