markets "contractSize" wrong data type
See original GitHub issue- OS: linux
- Programming Language version: all (although i personally only really care about python for now)
- CCXT version: latest main - v1.65.19
the type of contractSize seems to be a string throughout the exchanges I’ve tested - which seems and feels wrong to me.
Based on the documentation i’d expect it to be a float, which would align the “position structure” with the response of the market response.
I also don’t think any value other than a float will be a possible/allowed value for contractSize - as we’d expect to multiply (or divide) by that number to go from amount to what the exchange expects and viceversa.
Having this as string makes all calculations necessary for futures quite odd, as we’ll have to do explicitly convert contract-size to number (e.g. amount * float(market['contractSize'])
).
node examples/js/cli.js okex market BTC/USDT:USDT
okex.market (BTC/USDT:USDT)
0 ms
{ limits: { leverage: { min: undefined, max: 125 },
amount: { min: 1, max: undefined },
price: { min: 0.1, max: undefined },
cost: { min: 0.1, max: undefined } },
precision: { amount: 1, price: 0.1 },
tierBased: undefined,
percentage: undefined,
taker: 0.0005,
maker: 0.0002,
id: "BTC-USDT-SWAP",
symbol: "BTC/USDT:USDT",
base: "BTC",
quote: "USDT",
baseId: "BTC",
quoteId: "USDT",
settleId: "USDT",
settle: "USDT",
info: { alias: "",
baseCcy: "",
category: "1",
ctMult: "1",
ctType: "linear",
ctVal: "0.01",
ctValCcy: "BTC",
expTime: "",
instId: "BTC-USDT-SWAP",
instType: "SWAP",
lever: "125",
listTime: "1636620057000",
lotSz: "1",
minSz: "1",
optType: "",
quoteCcy: "",
settleCcy: "USDT",
state: "live",
stk: "",
tickSz: "0.1",
uly: "BTC-USDT" },
type: "swap",
spot: false,
futures: false,
swap: true,
contract: true,
option: false,
linear: true,
inverse: false,
active: true,
contractSize: "0.01", <-- would like to be a number ...
expiry: undefined,
expiryDatetime: undefined
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Fat-finger error - Wikipedia
A fat-finger error is a keyboard input error or mouse misclick in the financial markets such ... size than intended, for the wrong...
Read more >Responses to Frequently Asked Questions Concerning Rule ...
The exemption applies to transactions executed by a trading center to correct a “bona fide error,” which is defined as: (1) the inaccurate ......
Read more >Tick Size: Definition in Trading, Requirements, and Examples
Tick size is the minimum price amount a security can move in an exchange. It's expressed in decimal points, which in U.S. markets...
Read more >7 Tips Every Futures Trader Should Know | Charles Schwab
Here are seven strategies to help you improve your futures trading knowledge.
Read more >Excel: Stocks Data Type - Strategic Finance
When you first use the Stocks data type feature in a workbook, a message appears in the information bar to warn that the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah I think probably we’ll need to have a variable called
contractSizeString
or similarI think that we should convert
contractSize
to a string when we need to do string math internally, but the value returned from fetchMarkets should be a float. Almost every user would want the contract size to be a float, and would expect it to be a float, and returning a string is just kind of weird to the user when it’s only a string to help with internal use