Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop
This commit is contained in:
commit
9f42ffef74
261 files changed
+46426
-11895
No files matched your search
@@ -3242,8 +3242,7 @@
|
|||||||
"compatibleTypes": "->Prediction->"
|
"compatibleTypes": "->Prediction->"
|
||||||
},
|
},
|
||||||
"propertyNameAtParent": "predictionValue",
|
"propertyNameAtParent": "predictionValue",
|
||||||
"childrenNodesProperties": [
|
"childrenNodesProperties": [],
|
||||||
],
|
|
||||||
"icon": "bitcoin"
|
"icon": "bitcoin"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3415,8 +3414,7 @@
|
|||||||
"compatibleTypes": "->Feature->"
|
"compatibleTypes": "->Feature->"
|
||||||
},
|
},
|
||||||
"propertyNameAtParent": "featureValue",
|
"propertyNameAtParent": "featureValue",
|
||||||
"childrenNodesProperties": [
|
"childrenNodesProperties": [],
|
||||||
],
|
|
||||||
"icon": "bitcoin"
|
"icon": "bitcoin"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3588,8 +3586,7 @@
|
|||||||
"compatibleTypes": "->Label->"
|
"compatibleTypes": "->Label->"
|
||||||
},
|
},
|
||||||
"propertyNameAtParent": "labelValue",
|
"propertyNameAtParent": "labelValue",
|
||||||
"childrenNodesProperties": [
|
"childrenNodesProperties": [],
|
||||||
],
|
|
||||||
"icon": "bitcoin"
|
"icon": "bitcoin"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -15083,7 +15080,8 @@
|
|||||||
"childType": "Signals Provider",
|
"childType": "Signals Provider",
|
||||||
"autoAdd": true
|
"autoAdd": true
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"icon": "bitcoin"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Signals Provider",
|
"type": "Signals Provider",
|
||||||
@@ -15127,7 +15125,8 @@
|
|||||||
"config": "{ \n\"webhookURL\": \"Webhook/New-Message/Trading-View/Binance/BTC-USDT\",\n\"testMessage\": \"\" \n}"
|
"config": "{ \n\"webhookURL\": \"Webhook/New-Message/Trading-View/Binance/BTC-USDT\",\n\"testMessage\": \"\" \n}"
|
||||||
},
|
},
|
||||||
"propertyNameAtParent": "signalsProviders",
|
"propertyNameAtParent": "signalsProviders",
|
||||||
"childrenNodesProperties": []
|
"childrenNodesProperties": [],
|
||||||
|
"icon": "bitcoin"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Crypto Exchanges",
|
"type": "Crypto Exchanges",
|
||||||
|
|||||||
+23
-2
@@ -7,10 +7,31 @@
|
|||||||
"updated": 1610909304702
|
"updated": 1610909304702
|
||||||
},
|
},
|
||||||
"paragraphs": [
|
"paragraphs": [
|
||||||
|
{
|
||||||
|
"style": "Text",
|
||||||
|
"text": "This command will send all the changes you have made both at Docs pages but also at any file within the Superalgos Repository to your fork at Github.com and from there to the main Superalgos Repository. It will do it specifically from the Current Branch to the Contributions Branch mentioned at the footer of this page. ",
|
||||||
|
"updated": 1615288848213
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"style": "Important",
|
||||||
|
"text": "Contributions in most cases needs to come from the develop branch to the develop branch unless you have previously agreed with team members that you will send a contribution from master to master."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"style": "Text",
|
||||||
|
"text": "Master is our stable branch and it is very unlikely that we are going to merge contributions there. Instead all contributions are expected to go to the develop branch, where there are many users testing that branch every day, and the contribution will reach the master branch at the next relrease.",
|
||||||
|
"updated": 1615288915134
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"style": "Note",
|
||||||
|
"text": "It is also very unlikely that contributions coming from the master branch will be merged into the develop branch, since that can usually lead to merging conflicts. "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"style": "Text",
|
||||||
|
"text": "So be sure that your Current Branch is develop and the Contribution Branch is develop before submitting your contribution. "
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"style": "Title",
|
"style": "Title",
|
||||||
"text": "Syntax",
|
"text": "Syntax"
|
||||||
"updated": 1609943337280
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"style": "Javascript",
|
"style": "Javascript",
|
||||||
|
|||||||
+2
-7
@@ -58,11 +58,6 @@
|
|||||||
"text": "ABSOLUTE_DUST_IN_QUOTED_ASSET: is a numeric value that represents the distance that you allow to be between the Size Filled and the Target Side for a stage, measured in Base Asset. It's default value is Zero and you can define it at the config of a Stage node using the absoluteDustInQuotedAsset property.",
|
"text": "ABSOLUTE_DUST_IN_QUOTED_ASSET: is a numeric value that represents the distance that you allow to be between the Size Filled and the Target Side for a stage, measured in Base Asset. It's default value is Zero and you can define it at the config of a Stage node using the absoluteDustInQuotedAsset property.",
|
||||||
"updated": 1615054151393
|
"updated": 1615054151393
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"style": "Note",
|
|
||||||
"text": "The parameter that will actually be used from the two previous ones will depend on how you dedined your Target Size, either in Base Asset or Quoted Asset.",
|
|
||||||
"updated": 1615054261790
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"style": "Subtitle",
|
"style": "Subtitle",
|
||||||
"text": "Implementation",
|
"text": "Implementation",
|
||||||
@@ -74,8 +69,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"style": "Javascript",
|
"style": "Javascript",
|
||||||
"text": "switch (tradingEngineStage.stageDefinedIn.value) {\n case 'Base Asset': {\n if (\n tradingEngineStage.stageBaseAsset.sizeFilled.value\n * \n ROUNDING_ERROR_CORRECTION_FACTOR\n +\n ABSOLUTE_DUST_IN_BASE_ASSET\n >=\n tradingEngineStage.stageBaseAsset.targetSize.value\n ) {\n positionFilled()\n } else {\n checkCloseStageEvent(tradingSystemStage)\n }\n break\n }\n case 'Quoted Asset': {\n if (\n tradingEngineStage.stageQuotedAsset.sizeFilled.value\n * \n ROUNDING_ERROR_CORRECTION_FACTOR\n +\n ABSOLUTE_DUST_IN_QUOTED_ASSET\n >=\n tradingEngineStage.stageQuotedAsset.targetSize.value\n ) {\n positionFilled()\n } else {\n checkCloseStageEvent(tradingSystemStage)\n }\n break\n }\n }",
|
"text": " if (\n tradingEngineStage.stageBaseAsset.sizeFilled.value\n *\n ROUNDING_ERROR_CORRECTION_FACTOR\n +\n ABSOLUTE_DUST_IN_BASE_ASSET\n >=\n tradingEngineStage.stageBaseAsset.targetSize.value\n ) {\n positionFilled()\n } else if (\n tradingEngineStage.stageQuotedAsset.sizeFilled.value\n *\n ROUNDING_ERROR_CORRECTION_FACTOR\n +\n ABSOLUTE_DUST_IN_QUOTED_ASSET\n >=\n tradingEngineStage.stageQuotedAsset.targetSize.value\n ) {\n positionFilled()\n } else {\n checkCloseStageEvent(tradingSystemStage)\n }",
|
||||||
"updated": 1615054391439
|
"updated": 1615296774086
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
+2
-2
@@ -32,8 +32,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"style": "Javascript",
|
"style": "Javascript",
|
||||||
"text": "\nlet trailingStopLoss = 3 // Set the percentage you wish your Trailing Stop Loss to trail\n\nif ( chart.at01min.candle.close * ( 1 + (trailingStopLoss / 100) ) > tradingEngine.tradingCurrent.position.stopLoss.value ) {\nchart.at01min.candle.close * ( 1 + (trailingStopLoss / 100) )\n}\nelse {\ntradingEngine.tradingCurrent.position.stopLoss.value\n}",
|
"text": "let trailingStopLoss = 3 // Set the percentage you wish your Trailing Stop Loss to trail\n\nif ( chart.at01min.candle.close * ( 1 + (trailingStopLoss / 100) ) < tradingEngine.tradingCurrent.position.stopLoss.value ) {\nchart.at01min.candle.close * ( 1 + (trailingStopLoss / 100) )\n}\nelse {\ntradingEngine.tradingCurrent.position.stopLoss.value\n}",
|
||||||
"updated": 1615286314820
|
"updated": 1615297661487
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"style": "Important",
|
"style": "Important",
|
||||||
|
|||||||
+2
-2
@@ -39,8 +39,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"style": "Javascript",
|
"style": "Javascript",
|
||||||
"text": "\nlet riskPercentage = 2\n\nif ( tradingEngine.tradingCurrent.position.entryTargetRate.value * (1 + (( tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.balance.value * (riskPercentage / 100)) / tradingEngine.tradingCurrent.strategyOpenStage.stageQuotedAsset.sizeFilled.value)) > tradingEngine.tradingCurrent.position.stopLoss.value ) \n\n{\ntradingEngine.tradingCurrent.position.entryTargetRate.value * (1 + (( tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.balance.value * (riskPercentage / 100)) / tradingEngine.tradingCurrent.strategyOpenStage.stageQuotedAsset.sizeFilled.value))\n}\n\nelse {\ntradingEngine.tradingCurrent.position.stopLoss.value\n}",
|
"text": "let riskPercentage = 2\n\nif ( tradingEngine.tradingCurrent.position.entryTargetRate.value * (1 + (( tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.balance.value * (riskPercentage / 100)) / tradingEngine.tradingCurrent.strategyOpenStage.stageQuotedAsset.sizeFilled.value)) < tradingEngine.tradingCurrent.position.stopLoss.value ) \n\n{\ntradingEngine.tradingCurrent.position.entryTargetRate.value * (1 + (( tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.balance.value * (riskPercentage / 100)) / tradingEngine.tradingCurrent.strategyOpenStage.stageQuotedAsset.sizeFilled.value))\n}\n\nelse {\ntradingEngine.tradingCurrent.position.stopLoss.value\n}",
|
||||||
"updated": 1615287799360
|
"updated": 1615297434458
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"topic": "User Examples for Stop Loss ",
|
||||||
|
"pageNumber": 3,
|
||||||
|
"type": " Trailing Stop Loss - Initial Stop Loss, Risk and Targets Combo",
|
||||||
|
"definition": {
|
||||||
|
"text": "Setting an initial Risk Percentage of your Total Quoted Balance, after reaching the first Profit Target your first Trailing Stop Loss takes place. After reaching second Profit Target, we'll set the Trailing Stop Loss to a fixed percentage.",
|
||||||
|
"updated": 1615298179984
|
||||||
|
},
|
||||||
|
"paragraphs": [
|
||||||
|
{
|
||||||
|
"style": "Title",
|
||||||
|
"text": "Initial Stop Loss, Risk and Target Combo",
|
||||||
|
"updated": 1615297964577
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"style": "Text",
|
||||||
|
"text": "The idea of this is to initially give the position some space to move."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"style": "Text",
|
||||||
|
"text": "When ever the position reaches the first Profit Target, it will use a Trailing Stop Loss set to the Profit divided by your Profit Divider. After reaching the second Profit Target, the Trailing Stop Loss will use a fixed percentage."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"style": "Subtitle",
|
||||||
|
"text": "Example for a Long Position"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"style": "Javascript",
|
||||||
|
"text": "\nriskPercentage = 1 // Initial Stop Loss is set by this Risk Percentage out of your Total Quoted Balance\n\nprofitTarget1 = 0.5 // First Percent Profit\nprofitDivider = 2 // The profit will be divided with this value and set your Stop Loss to the Entry Rate + Half Profit\n\nprofitTarget2 = 5 // Second Percent Profit\ntrailingStopLoss = 2.5 // Fixed Trailing Percentage\n\nif ( chart.at01min.candle.close > (tradingEngine.tradingCurrent.position.entryTargetRate.value * (1 + (profitTarget2 / 100))) && tradingEngine.tradingCurrent.position.stopLoss.value < (chart.at01min.candle.close * (1 - (trailingStopLoss2 / 100))) ) {\n chart.at01min.candle.close * (1 - (trailingStopLoss / 100))\n}\n\nelse if ( chart.at01min.candle.close > (tradingEngine.tradingCurrent.position.entryTargetRate.value * (1 + (profitTarget1 / 100))) && tradingEngine.tradingCurrent.position.stopLoss.value < chart.at01min.candle.close - ( (chart.at01min.candle.close - tradingEngine.tradingCurrent.position.entryTargetRate.value) / profitDivider) ) {\n chart.at01min.candle.close - ( (chart.at01min.candle.close - tradingEngine.tradingCurrent.position.entryTargetRate.value) / profitDivider)\n}\n\nelse {\n tradingEngine.tradingCurrent.position.entryTargetRate.value * (1 - (( tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.balance.value * (riskPercentage / 100)) / tradingEngine.tradingCurrent.strategyOpenStage.stageQuotedAsset.sizeFilled.value))\n}",
|
||||||
|
"updated": 1615298020120
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"style": "Subtitle",
|
||||||
|
"text": "Example for a Short Position",
|
||||||
|
"updated": 1615298191803
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"style": "Javascript",
|
||||||
|
"text": "\nriskPercentage = 1 // Initial Stop Loss is set by this Risk Percentage out of your Total Quoted Balance\n\nprofitTarget1 = 0.5 // First Percent Profit\nprofitDivider = 2 // The profit will be divided with this value and set your Stop Loss to the Entry Rate + Half Profit\n\nprofitTarget2 = 5 // Second Percent Profit\ntrailingStopLoss = 2.5 // Fixed Trailing Percentage\n\nif ( chart.at01min.candle.close < (tradingEngine.tradingCurrent.position.entryTargetRate.value * (1 - (profitTarget2 / 100))) && tradingEngine.tradingCurrent.position.stopLoss.value > (chart.at01min.candle.close * (1 + (trailingStopLoss2 / 100))) ) {\n chart.at01min.candle.close * (1 + (trailingStopLoss / 100))\n}\n\nelse if ( chart.at01min.candle.close < (tradingEngine.tradingCurrent.position.entryTargetRate.value * (1 - (profitTarget1 / 100))) && tradingEngine.tradingCurrent.position.stopLoss.value > chart.at01min.candle.close + ( (chart.at01min.candle.close - tradingEngine.tradingCurrent.position.entryTargetRate.value) / profitDivider) ) {\n chart.at01min.candle.close + ( (chart.at01min.candle.close + tradingEngine.tradingCurrent.position.entryTargetRate.value) / profitDivider)\n}\n\nelse {\n tradingEngine.tradingCurrent.position.entryTargetRate.value * (1 + (( tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.balance.value * (riskPercentage / 100)) / tradingEngine.tradingCurrent.strategyOpenStage.stageQuotedAsset.sizeFilled.value))\n}",
|
||||||
|
"updated": 1615298026442
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
build/*
|
||||||
Generated
+1
@@ -1,4 +1,5 @@
|
|||||||
*.* text eol=lf
|
*.* text eol=lf
|
||||||
php/test/*.php linguist-generated=true
|
php/test/*.php linguist-generated=true
|
||||||
|
php/*.php linguist-generated=true
|
||||||
python/ccxt/*.py linguist-generated=true
|
python/ccxt/*.py linguist-generated=true
|
||||||
python/ccxt/__init__.py linguist-generated=false
|
python/ccxt/__init__.py linguist-generated=false
|
||||||
Generated
Vendored
+1
-9
@@ -246,7 +246,7 @@ These files containing derived exchange classes are transpiled from JS into Pyth
|
|||||||
|
|
||||||
- `js/[_a-z].js` → `python/ccxt/async/[_a-z].py`
|
- `js/[_a-z].js` → `python/ccxt/async/[_a-z].py`
|
||||||
- `python/ccxt/async[_a-z].py` → `python/ccxt/[_a-z].py` (Python 3 asyncio → Python 2 sync transpilation stage)
|
- `python/ccxt/async[_a-z].py` → `python/ccxt/[_a-z].py` (Python 3 asyncio → Python 2 sync transpilation stage)
|
||||||
- `python/test/test_async.py` → `python/test/test.py` (the sync test is generated from the async test)
|
- `python/ccxt/test/test_async.py` → `python/ccxt/test/test_sync.py` (the sync test is generated from the async test)
|
||||||
|
|
||||||
These Python base classes and files are not transpiled:
|
These Python base classes and files are not transpiled:
|
||||||
|
|
||||||
@@ -868,14 +868,6 @@ npm run git-unignore-generated-files
|
|||||||
## Financial Contributions
|
## Financial Contributions
|
||||||
|
|
||||||
We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/ccxt).
|
We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/ccxt).
|
||||||
Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
|
|
||||||
|
|
||||||
```
|
|
||||||
ETH 0x26a3CB49578F07000575405a57888681249c35Fd (ETH only!)
|
|
||||||
BTC 33RmVRfhK2WZVQR1R83h2e9yXoqRNDvJva
|
|
||||||
BCH 1GN9p233TvNcNQFthCgfiHUnj5JRKEc2Ze
|
|
||||||
LTC LbT8mkAqQBphc4yxLXEDgYDfEax74et3bP
|
|
||||||
```
|
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
|
|||||||
Generated
Vendored
+35
-37
@@ -1,11 +1,11 @@
|
|||||||
# CCXT – CryptoCurrency eXchange Trading Library
|
# CCXT – CryptoCurrency eXchange Trading Library
|
||||||
|
|
||||||
[](https://travis-ci.com/ccxt/ccxt) [](https://npmjs.com/package/ccxt) [](https://pypi.python.org/pypi/ccxt) [](https://www.npmjs.com/package/ccxt) [](https://discord.gg/dhzSKYU) [](https://github.com/ccxt/ccxt/wiki/Exchange-Markets) [](https://opencollective.com/ccxt)
|
[](https://travis-ci.com/ccxt/ccxt) [](https://npmjs.com/package/ccxt) [](https://pypi.python.org/pypi/ccxt) [](https://www.npmjs.com/package/ccxt) [](https://discord.gg/dhzSKYU) [](https://github.com/ccxt/ccxt/wiki/Exchange-Markets) [](https://opencollective.com/ccxt)
|
||||||
[](https://twitter.com/ccxt_official)
|
[](https://twitter.com/ccxt_official)
|
||||||
|
|
||||||
A JavaScript / Python / PHP library for cryptocurrency trading and e-commerce with support for many bitcoin/ether/altcoin exchange markets and merchant APIs.
|
A JavaScript / Python / PHP library for cryptocurrency trading and e-commerce with support for many bitcoin/ether/altcoin exchange markets and merchant APIs.
|
||||||
|
|
||||||
### [Install](#install) · [Usage](#usage) · [Manual](https://github.com/ccxt/ccxt/wiki) · [FAQ](https://github.com/ccxt/ccxt/wiki/FAQ) · [Examples](https://github.com/ccxt/ccxt/tree/master/examples) · [Contributing](https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md) · [Social](#social)
|
### [Install](#install) · [Usage](#usage) · [Manual](https://github.com/ccxt/ccxt/wiki) · [FAQ](https://github.com/ccxt/ccxt/wiki/FAQ) · [Examples](https://github.com/ccxt/ccxt/tree/master/examples) · [Contributing](https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md) · [Social](#social) · [CCXT Pro](https://ccxt.pro)
|
||||||
|
|
||||||
The **CCXT** library is used to connect and trade with cryptocurrency 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, and related software engineering.
|
The **CCXT** library is used to connect and trade with cryptocurrency 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, and related software engineering.
|
||||||
|
|
||||||
@@ -21,42 +21,44 @@ Current feature list:
|
|||||||
|
|
||||||
## Sponsored Promotion
|
## Sponsored Promotion
|
||||||
|
|
||||||
[](https://ccxt.pro) **[A JavaScript / Python / PHP cryptocurrency exchange trading WebSocket API for professionals](https://ccxt.pro)**
|
[](https://ccxt.pro)
|
||||||
|
|
||||||
## See Also
|
## See Also
|
||||||
|
|
||||||
- <sub>[](https://quadency.com?utm_source=ccxt)</sub> **[Quadency](https://quadency.com?utm_source=ccxt)** — trading automation terminal for leading exchanges with streaming APIs + Python IDE.
|
- <sub>[](https://quadency.com?utm_source=ccxt)</sub> **[Quadency](https://quadency.com?utm_source=ccxt)** — trading automation terminal for leading exchanges with streaming APIs + Python IDE.
|
||||||
- <sub>[](https://tab-trader.com/?utm_source=ccxt)</sub> **[TabTrader](https://tab-trader.com/?utm_source=ccxt)** — trading on all exchanges in one app. Avaliable on [Android](https://play.google.com/store/apps/details?id=com.tabtrader.android&referrer=utm_source%3Dccxt) and [iOS](https://itunes.apple.com/app/apple-store/id1095716562?mt=8).
|
- <sub>[](https://tab-trader.com/?utm_source=ccxt)</sub> **[TabTrader](https://tab-trader.com/?utm_source=ccxt)** — trading on all exchanges in one app. Avaliable on [Android](https://play.google.com/store/apps/details?id=com.tabtrader.android&referrer=utm_source%3Dccxt) and [iOS](https://itunes.apple.com/app/apple-store/id1095716562?mt=8).
|
||||||
|
- <sub>[](https://www.pionex.com/en-US/sign?r=8wSFCbNk&utm_source=ad&utm_medium=banner&utm_campaign=ccxt-2)</sub> **[Pionex](https://www.pionex.com/en-US/sign?r=8wSFCbNk&utm_source=ad&utm_medium=banner&utm_campaign=ccxt-2)** — 6 grid bots, spot-futures arb bot, smart trade and DCA bots. Free for [Android](https://play.google.com/store/apps/details?id=com.pionex.client&referrer=utm_source%3Dccxt) and [iOS](https://apps.apple.com/us/app/pionex/id1485348891?pt=ccxt&ct=inline)!
|
||||||
|
- <sub>[](https://www.aaxpro.com/en-US/ad-sign-up/?utm_source=ccxt&utm_medium=one-liner&utm_campaign=futures)</sub> **[AAX](https://www.aaxpro.com/en-US/ad-sign-up/?utm_source=ccxt&utm_medium=one-liner&utm_campaign=futures)** — trade bitcoin futures with fees as low as 0.02% and up to 100x leverage!
|
||||||
|
|
||||||
|
|
||||||
## Certified Cryptocurrency Exchanges
|
## Certified Cryptocurrency Exchanges
|
||||||
|
|
||||||
|
|
||||||
| logo | id | name | ver | doc | certified | pro |
|
| logo | id | name | ver | doc | certified | pro |
|
||||||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|-----------------------------------------------------------------------------|:---:|:----------------------------------------------------------------------------------:|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
|
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|-----------------------------------------------------------------------------|:---:|:------------------------------------------------------------------:|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
|
||||||
| [](https://www.binance.com/?ref=10205187) | binance | [Binance](https://www.binance.com/?ref=10205187) | * | [API](https://binance-docs.github.io/apidocs/spot/en) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
| [](https://www.aaxpro.com/invite/sign-up?inviteCode=JXGm5Fy7R2MB) | aax | [AAX](https://www.aaxpro.com/invite/sign-up?inviteCode=JXGm5Fy7R2MB) | 2 | [API](https://www.aaxpro.com/apidoc/index.html) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
||||||
| [](https://www.bitfinex.com/?refcode=P61eYxFL) | bitfinex | [Bitfinex](https://www.bitfinex.com/?refcode=P61eYxFL) | 1 | [API](https://docs.bitfinex.com/v1/docs) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
| [](https://www.binance.com/?ref=10205187) | binance | [Binance](https://www.binance.com/?ref=10205187) | * | [API](https://binance-docs.github.io/apidocs/spot/en) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
||||||
| [](https://bittrex.com/Account/Register?referralCode=1ZE-G0G-M3B) | bittrex | [Bittrex](https://bittrex.com/Account/Register?referralCode=1ZE-G0G-M3B) | 3 | [API](https://bittrex.github.io/api/v3) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
| [](https://bittrex.com/Account/Register?referralCode=1ZE-G0G-M3B) | bittrex | [Bittrex](https://bittrex.com/Account/Register?referralCode=1ZE-G0G-M3B) | 3 | [API](https://bittrex.github.io/api/v3) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
||||||
| [](https://bitvavo.com/?a=24F34952F7) | bitvavo | [Bitvavo](https://bitvavo.com/?a=24F34952F7) | 2 | [API](https://docs.bitvavo.com/) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
| [](https://bitvavo.com/?a=24F34952F7) | bitvavo | [Bitvavo](https://bitvavo.com/?a=24F34952F7) | 2 | [API](https://docs.bitvavo.com/) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
||||||
| [](https://www.byte-trade.com) | bytetrade | [ByteTrade](https://www.byte-trade.com) | * | [API](https://docs.byte-trade.com/#description) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
| [](https://www.byte-trade.com) | bytetrade | [ByteTrade](https://www.byte-trade.com) | * | [API](https://docs.byte-trade.com/#description) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
||||||
| [](https://currency.com/trading/signup?c=362jaimv&pid=referral) | currencycom | [Currency.com](https://currency.com/trading/signup?c=362jaimv&pid=referral) | 1 | [API](https://currency.com/api) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
| [](https://currency.com/trading/signup?c=362jaimv&pid=referral) | currencycom | [Currency.com](https://currency.com/trading/signup?c=362jaimv&pid=referral) | 1 | [API](https://currency.com/api) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
||||||
| [](https://eterbase.exchange/invite/1wjjh4Pe) | eterbase | [Eterbase](https://eterbase.exchange/invite/1wjjh4Pe) | 1 | [API](https://developers.eterbase.exchange) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
| [](https://eterbase.exchange/invite/1wjjh4Pe) | eterbase | [Eterbase](https://eterbase.exchange/invite/1wjjh4Pe) | 1 | [API](https://developers.eterbase.exchange) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
||||||
| [](https://ftx.com/#a=1623029) | ftx | [FTX](https://ftx.com/#a=1623029) | * | [API](https://github.com/ftexchange/ftx) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
| [](https://ftx.com/#a=1623029) | ftx | [FTX](https://ftx.com/#a=1623029) | * | [API](https://github.com/ftexchange/ftx) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
||||||
| [](https://idex.io) | idex | [IDEX](https://idex.io) | 2 | [API](https://docs.idex.io/) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
| [](https://www.gopax.co.kr) | gopax | [GOPAX](https://www.gopax.co.kr) | 1 | [API](https://gopax.github.io/API/index.en.html) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
||||||
| [](https://www.kraken.com) | kraken | [Kraken](https://www.kraken.com) | 0 | [API](https://www.kraken.com/features/api) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
| [](https://idex.io) | idex | [IDEX](https://idex.io) | 2 | [API](https://docs.idex.io/) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
||||||
| [](https://upbit.com) | upbit | [Upbit](https://upbit.com) | 1 | [API](https://docs.upbit.com/docs/%EC%9A%94%EC%B2%AD-%EC%88%98-%EC%A0%9C%ED%95%9C) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
| [](https://www.kraken.com) | kraken | [Kraken](https://www.kraken.com) | 0 | [API](https://www.kraken.com/features/api) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
||||||
| [](https://waves.exchange) | wavesexchange | [Waves.Exchange](https://waves.exchange) | * | [API](https://docs.waves.exchange) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
| [](https://waves.exchange) | wavesexchange | [Waves.Exchange](https://waves.exchange) | * | [API](https://docs.waves.exchange) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
||||||
| [](https://xena.exchange) | xena | [Xena Exchange](https://xena.exchange) | * | [API](https://support.xena.exchange/support/solutions/44000808700) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
| [](https://xena.exchange) | xena | [Xena Exchange](https://xena.exchange) | * | [API](https://support.xena.exchange/support/solutions/44000808700) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
||||||
|
|
||||||
## Supported Cryptocurrency Exchange Markets
|
## Supported Cryptocurrency Exchange Markets
|
||||||
|
|
||||||
The CCXT library currently supports the following 123 cryptocurrency exchange markets and trading APIs:
|
The CCXT library currently supports the following 126 cryptocurrency exchange markets and trading APIs:
|
||||||
|
|
||||||
| logo | id | name | ver | doc | certified | pro |
|
| logo | id | name | ver | doc | certified | pro |
|
||||||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|-----------------------------------------------------------------------------------------|:---:|:-------------------------------------------------------------------------------------------:|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
|
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|-----------------------------------------------------------------------------------------|:---:|:-------------------------------------------------------------------------------------------:|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
|
||||||
|
| [](https://www.aaxpro.com/invite/sign-up?inviteCode=JXGm5Fy7R2MB) | aax | [AAX](https://www.aaxpro.com/invite/sign-up?inviteCode=JXGm5Fy7R2MB) | 2 | [API](https://www.aaxpro.com/apidoc/index.html) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
||||||
| [](https://acx.io) | acx | [ACX](https://acx.io) | 2 | [API](https://acx.io/documents/api_v2) | | |
|
| [](https://acx.io) | acx | [ACX](https://acx.io) | 2 | [API](https://acx.io/documents/api_v2) | | |
|
||||||
| [](https://aofex.com/#/register?key=9763840) | aofex | [AOFEX](https://aofex.com/#/register?key=9763840) | * | [API](https://aofex.zendesk.com/hc/en-us/sections/360005576574-API) | | |
|
| [](https://aofex.com/#/register?key=9763840) | aofex | [AOFEX](https://aofex.com/#/register?key=9763840) | * | [API](https://aofex.zendesk.com/hc/en-us/sections/360005576574-API) | | |
|
||||||
| [](https://www.bcex.top/register?invite_code=758978&lang=en) | bcex | [BCEX](https://www.bcex.top/register?invite_code=758978&lang=en) | 1 | [API](https://github.com/BCEX-TECHNOLOGY-LIMITED/API_Docs/wiki/Interface) | | |
|
|
||||||
| [](https://bequant.io) | bequant | [Bequant](https://bequant.io) | 2 | [API](https://api.bequant.io/) | | [](https://ccxt.pro) |
|
| [](https://bequant.io) | bequant | [Bequant](https://bequant.io) | 2 | [API](https://api.bequant.io/) | | [](https://ccxt.pro) |
|
||||||
| [](https://w2.bibox365.com/login/register?invite_code=05Kj3I) | bibox | [Bibox](https://w2.bibox365.com/login/register?invite_code=05Kj3I) | 1 | [API](https://biboxcom.github.io/en/) | | |
|
| [](https://w2.bibox365.com/login/register?invite_code=05Kj3I) | bibox | [Bibox](https://w2.bibox365.com/login/register?invite_code=05Kj3I) | 1 | [API](https://biboxcom.github.io/en/) | | |
|
||||||
| [](https://b1.run/users/new?code=D3LLBVFT) | bigone | [BigONE](https://b1.run/users/new?code=D3LLBVFT) | 3 | [API](https://open.big.one/docs/api.html) | | |
|
| [](https://b1.run/users/new?code=D3LLBVFT) | bigone | [BigONE](https://b1.run/users/new?code=D3LLBVFT) | 3 | [API](https://open.big.one/docs/api.html) | | |
|
||||||
@@ -66,14 +68,14 @@ The CCXT library currently supports the following 123 cryptocurrency exchange ma
|
|||||||
| [](https://bitbank.cc/) | bitbank | [bitbank](https://bitbank.cc/) | 1 | [API](https://docs.bitbank.cc/) | | |
|
| [](https://bitbank.cc/) | bitbank | [bitbank](https://bitbank.cc/) | 1 | [API](https://docs.bitbank.cc/) | | |
|
||||||
| [](https://auth.bitbay.net/ref/jHlbB4mIkdS1) | bitbay | [BitBay](https://auth.bitbay.net/ref/jHlbB4mIkdS1) | * | [API](https://bitbay.net/public-api) | | |
|
| [](https://auth.bitbay.net/ref/jHlbB4mIkdS1) | bitbay | [BitBay](https://auth.bitbay.net/ref/jHlbB4mIkdS1) | * | [API](https://bitbay.net/public-api) | | |
|
||||||
| [](https://exchange.bitcoin.com/referral/da948b21d6c92d69) | bitcoincom | [bitcoin.com](https://exchange.bitcoin.com/referral/da948b21d6c92d69) | 2 | [API](https://api.exchange.bitcoin.com/api/2/explore) | | [](https://ccxt.pro) |
|
| [](https://exchange.bitcoin.com/referral/da948b21d6c92d69) | bitcoincom | [bitcoin.com](https://exchange.bitcoin.com/referral/da948b21d6c92d69) | 2 | [API](https://api.exchange.bitcoin.com/api/2/explore) | | [](https://ccxt.pro) |
|
||||||
| [](https://www.bitfinex.com/?refcode=P61eYxFL) | bitfinex | [Bitfinex](https://www.bitfinex.com/?refcode=P61eYxFL) | 1 | [API](https://docs.bitfinex.com/v1/docs) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
| [](https://www.bitfinex.com/?refcode=P61eYxFL) | bitfinex | [Bitfinex](https://www.bitfinex.com/?refcode=P61eYxFL) | 1 | [API](https://docs.bitfinex.com/v1/docs) | | [](https://ccxt.pro) |
|
||||||
| [](https://www.bitfinex.com/?refcode=P61eYxFL) | bitfinex2 | [Bitfinex](https://www.bitfinex.com/?refcode=P61eYxFL) | 2 | [API](https://docs.bitfinex.com/v2/docs/) | | |
|
| [](https://www.bitfinex.com/?refcode=P61eYxFL) | bitfinex2 | [Bitfinex](https://www.bitfinex.com/?refcode=P61eYxFL) | 2 | [API](https://docs.bitfinex.com/v2/docs/) | | |
|
||||||
| [](https://bitflyer.com) | bitflyer | [bitFlyer](https://bitflyer.com) | 1 | [API](https://lightning.bitflyer.com/docs?lang=en) | | |
|
| [](https://bitflyer.com) | bitflyer | [bitFlyer](https://bitflyer.com) | 1 | [API](https://lightning.bitflyer.com/docs?lang=en) | | |
|
||||||
| [](https://www.bitforex.com/en/invitationRegister?inviterId=1867438) | bitforex | [Bitforex](https://www.bitforex.com/en/invitationRegister?inviterId=1867438) | 1 | [API](https://github.com/githubdev2020/API_Doc_en/wiki) | | |
|
| [](https://www.bitforex.com/en/invitationRegister?inviterId=1867438) | bitforex | [Bitforex](https://www.bitforex.com/en/invitationRegister?inviterId=1867438) | 1 | [API](https://github.com/githubdev2020/API_Doc_en/wiki) | | |
|
||||||
| [](https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j) | bitget | [Bitget](https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j) | 3 | [API](https://bitgetlimited.github.io/apidoc/en/swap) | | |
|
| [](https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j) | bitget | [Bitget](https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j) | 3 | [API](https://bitgetlimited.github.io/apidoc/en/swap) | | |
|
||||||
| [](https://www.bithumb.com) | bithumb | [Bithumb](https://www.bithumb.com) | * | [API](https://apidocs.bithumb.com) | | |
|
| [](https://www.bithumb.com) | bithumb | [Bithumb](https://www.bithumb.com) | * | [API](https://apidocs.bithumb.com) | | |
|
||||||
| [](https://www.bitkk.com) | bitkk | [bitkk](https://www.bitkk.com) | 1 | [API](https://www.bitkk.com/i/developer) | | |
|
| [](https://www.bitkk.com) | bitkk | [bitkk](https://www.bitkk.com) | 1 | [API](https://www.bitkk.com/i/developer) | | |
|
||||||
| [](http://www.bitmart.com/?r=rQCFLh) | bitmart | [BitMart](http://www.bitmart.com/?r=rQCFLh) | 1 | [API](https://github.com/bitmartexchange/bitmart-official-api-docs) | | |
|
| [](http://www.bitmart.com/?r=rQCFLh) | bitmart | [BitMart](http://www.bitmart.com/?r=rQCFLh) | 1 | [API](https://developer-pro.bitmart.com/) | | |
|
||||||
| [](https://bitmax.io/#/register?inviteCode=EL6BXBQM) | bitmax | [BitMax](https://bitmax.io/#/register?inviteCode=EL6BXBQM) | 1 | [API](https://bitmax-exchange.github.io/bitmax-pro-api/#bitmax-pro-api-documentation) | | |
|
| [](https://bitmax.io/#/register?inviteCode=EL6BXBQM) | bitmax | [BitMax](https://bitmax.io/#/register?inviteCode=EL6BXBQM) | 1 | [API](https://bitmax-exchange.github.io/bitmax-pro-api/#bitmax-pro-api-documentation) | | |
|
||||||
| [](https://www.bitmex.com/register/upZpOX) | bitmex | [BitMEX](https://www.bitmex.com/register/upZpOX) | 1 | [API](https://www.bitmex.com/app/apiOverview) | | [](https://ccxt.pro) |
|
| [](https://www.bitmex.com/register/upZpOX) | bitmex | [BitMEX](https://www.bitmex.com/register/upZpOX) | 1 | [API](https://www.bitmex.com/app/apiOverview) | | [](https://ccxt.pro) |
|
||||||
| [](https://www.bitpanda.com/en/pro) | bitpanda | [Bitpanda Pro](https://www.bitpanda.com/en/pro) | 1 | [API](https://developers.bitpanda.com/exchange/) | | |
|
| [](https://www.bitpanda.com/en/pro) | bitpanda | [Bitpanda Pro](https://www.bitpanda.com/en/pro) | 1 | [API](https://developers.bitpanda.com/exchange/) | | |
|
||||||
@@ -95,6 +97,7 @@ The CCXT library currently supports the following 123 cryptocurrency exchange ma
|
|||||||
| [](https://www.bw.com/regGetCommission/N3JuT1R3bWxKTE0) | bw | [BW](https://www.bw.com/regGetCommission/N3JuT1R3bWxKTE0) | 1 | [API](https://github.com/bw-exchange/api_docs_en/wiki) | | |
|
| [](https://www.bw.com/regGetCommission/N3JuT1R3bWxKTE0) | bw | [BW](https://www.bw.com/regGetCommission/N3JuT1R3bWxKTE0) | 1 | [API](https://github.com/bw-exchange/api_docs_en/wiki) | | |
|
||||||
| [](https://www.bybit.com/app/register?ref=X7Prm) | bybit | [Bybit](https://www.bybit.com/app/register?ref=X7Prm) | 2 | [API](https://bybit-exchange.github.io/docs/inverse/) | | |
|
| [](https://www.bybit.com/app/register?ref=X7Prm) | bybit | [Bybit](https://www.bybit.com/app/register?ref=X7Prm) | 2 | [API](https://bybit-exchange.github.io/docs/inverse/) | | |
|
||||||
| [](https://www.byte-trade.com) | bytetrade | [ByteTrade](https://www.byte-trade.com) | * | [API](https://docs.byte-trade.com/#description) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
| [](https://www.byte-trade.com) | bytetrade | [ByteTrade](https://www.byte-trade.com) | * | [API](https://docs.byte-trade.com/#description) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
||||||
|
| [](https://cdax.io/invite?invite_code=esc74) | cdax | [CDAX](https://cdax.io/invite?invite_code=esc74) | 1 | [API](https://github.com/cloudapidoc/API_Docs) | | |
|
||||||
| [](https://cex.io/r/0/up105393824/0/) | cex | [CEX.IO](https://cex.io/r/0/up105393824/0/) | * | [API](https://cex.io/cex-api) | | |
|
| [](https://cex.io/r/0/up105393824/0/) | cex | [CEX.IO](https://cex.io/r/0/up105393824/0/) | * | [API](https://cex.io/cex-api) | | |
|
||||||
| [](https://chilebit.net) | chilebit | [ChileBit](https://chilebit.net) | 1 | [API](https://blinktrade.com/docs) | | |
|
| [](https://chilebit.net) | chilebit | [ChileBit](https://chilebit.net) | 1 | [API](https://blinktrade.com/docs) | | |
|
||||||
| [](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | coinbase | [Coinbase](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | 2 | [API](https://developers.coinbase.com/api/v2) | | |
|
| [](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | coinbase | [Coinbase](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | 2 | [API](https://developers.coinbase.com/api/v2) | | |
|
||||||
@@ -112,9 +115,11 @@ The CCXT library currently supports the following 123 cryptocurrency exchange ma
|
|||||||
| [](https://www.coinspot.com.au/register?code=PJURCU) | coinspot | [CoinSpot](https://www.coinspot.com.au/register?code=PJURCU) | * | [API](https://www.coinspot.com.au/api) | | |
|
| [](https://www.coinspot.com.au/register?code=PJURCU) | coinspot | [CoinSpot](https://www.coinspot.com.au/register?code=PJURCU) | * | [API](https://www.coinspot.com.au/api) | | |
|
||||||
| [](https://crex24.com/?refid=slxsjsjtil8xexl9hksr) | crex24 | [CREX24](https://crex24.com/?refid=slxsjsjtil8xexl9hksr) | 2 | [API](https://docs.crex24.com/trade-api/v2) | | |
|
| [](https://crex24.com/?refid=slxsjsjtil8xexl9hksr) | crex24 | [CREX24](https://crex24.com/?refid=slxsjsjtil8xexl9hksr) | 2 | [API](https://docs.crex24.com/trade-api/v2) | | |
|
||||||
| [](https://currency.com/trading/signup?c=362jaimv&pid=referral) | currencycom | [Currency.com](https://currency.com/trading/signup?c=362jaimv&pid=referral) | 1 | [API](https://currency.com/api) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
| [](https://currency.com/trading/signup?c=362jaimv&pid=referral) | currencycom | [Currency.com](https://currency.com/trading/signup?c=362jaimv&pid=referral) | 1 | [API](https://currency.com/api) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
||||||
|
| [](https://www.delta.exchange/app/signup/?code=IULYNB) | delta | [Delta Exchange](https://www.delta.exchange/app/signup/?code=IULYNB) | 2 | [API](https://docs.delta.exchange) | | |
|
||||||
| [](https://www.deribit.com/reg-1189.4038) | deribit | [Deribit](https://www.deribit.com/reg-1189.4038) | 2 | [API](https://docs.deribit.com/v2) | | |
|
| [](https://www.deribit.com/reg-1189.4038) | deribit | [Deribit](https://www.deribit.com/reg-1189.4038) | 2 | [API](https://docs.deribit.com/v2) | | |
|
||||||
| [](https://www.digifinex.com/en-ww/from/DhOzBg?channelCode=ljaUPp) | digifinex | [DigiFinex](https://www.digifinex.com/en-ww/from/DhOzBg?channelCode=ljaUPp) | 3 | [API](https://docs.digifinex.com) | | |
|
| [](https://www.digifinex.com/en-ww/from/DhOzBg?channelCode=ljaUPp) | digifinex | [DigiFinex](https://www.digifinex.com/en-ww/from/DhOzBg?channelCode=ljaUPp) | 3 | [API](https://docs.digifinex.com) | | |
|
||||||
| [](https://dsxglobal.com) | dsx | [DSX](https://dsxglobal.com) | 3 | [API](https://dsxglobal.com/developers/publicApi) | | |
|
| [](https://dsxglobal.com) | dsx | [DSX](https://dsxglobal.com) | 3 | [API](https://dsxglobal.com/developers/publicApi) | | |
|
||||||
|
| [](https://equos.io?referredByCode=zpa8kij4ouvBFup3) | equos | [EQUOS](https://equos.io?referredByCode=zpa8kij4ouvBFup3) | * | [API](https://developer.equos.io) | | |
|
||||||
| [](https://eterbase.exchange/invite/1wjjh4Pe) | eterbase | [Eterbase](https://eterbase.exchange/invite/1wjjh4Pe) | 1 | [API](https://developers.eterbase.exchange) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
| [](https://eterbase.exchange/invite/1wjjh4Pe) | eterbase | [Eterbase](https://eterbase.exchange/invite/1wjjh4Pe) | 1 | [API](https://developers.eterbase.exchange) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
||||||
| [](https://exmo.me/?ref=131685) | exmo | [EXMO](https://exmo.me/?ref=131685) | 1.1 | [API](https://exmo.me/en/api_doc?ref=131685) | | |
|
| [](https://exmo.me/?ref=131685) | exmo | [EXMO](https://exmo.me/?ref=131685) | 1.1 | [API](https://exmo.me/en/api_doc?ref=131685) | | |
|
||||||
| [](https://www.exx.com/r/fde4260159e53ab8a58cc9186d35501f?recommQd=1) | exx | [EXX](https://www.exx.com/r/fde4260159e53ab8a58cc9186d35501f?recommQd=1) | * | [API](https://www.exx.com/help/restApi) | | |
|
| [](https://www.exx.com/r/fde4260159e53ab8a58cc9186d35501f?recommQd=1) | exx | [EXX](https://www.exx.com/r/fde4260159e53ab8a58cc9186d35501f?recommQd=1) | * | [API](https://www.exx.com/help/restApi) | | |
|
||||||
@@ -125,12 +130,12 @@ The CCXT library currently supports the following 123 cryptocurrency exchange ma
|
|||||||
| [](https://ftx.com/#a=1623029) | ftx | [FTX](https://ftx.com/#a=1623029) | * | [API](https://github.com/ftexchange/ftx) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
| [](https://ftx.com/#a=1623029) | ftx | [FTX](https://ftx.com/#a=1623029) | * | [API](https://github.com/ftexchange/ftx) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
||||||
| [](https://www.gate.io/signup/2436035) | gateio | [Gate.io](https://www.gate.io/signup/2436035) | 2 | [API](https://gate.io/api2) | | [](https://ccxt.pro) |
|
| [](https://www.gate.io/signup/2436035) | gateio | [Gate.io](https://www.gate.io/signup/2436035) | 2 | [API](https://gate.io/api2) | | [](https://ccxt.pro) |
|
||||||
| [](https://gemini.com/) | gemini | [Gemini](https://gemini.com/) | 1 | [API](https://docs.gemini.com/rest-api) | | |
|
| [](https://gemini.com/) | gemini | [Gemini](https://gemini.com/) | 1 | [API](https://docs.gemini.com/rest-api) | | |
|
||||||
|
| [](https://www.gopax.co.kr) | gopax | [GOPAX](https://www.gopax.co.kr) | 1 | [API](https://gopax.github.io/API/index.en.html) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
||||||
| [](https://www.hbtc.com/register/O2S8NS) | hbtc | [HBTC](https://www.hbtc.com/register/O2S8NS) | 1 | [API](https://github.com/bhexopen/BHEX-OpenApi/tree/master/doc) | | |
|
| [](https://www.hbtc.com/register/O2S8NS) | hbtc | [HBTC](https://www.hbtc.com/register/O2S8NS) | 1 | [API](https://github.com/bhexopen/BHEX-OpenApi/tree/master/doc) | | |
|
||||||
| [](https://hitbtc.com/?ref_id=5a5d39a65d466) | hitbtc | [HitBTC](https://hitbtc.com/?ref_id=5a5d39a65d466) | 2 | [API](https://api.hitbtc.com) | | [](https://ccxt.pro) |
|
| [](https://hitbtc.com/?ref_id=5a5d39a65d466) | hitbtc | [HitBTC](https://hitbtc.com/?ref_id=5a5d39a65d466) | 2 | [API](https://api.hitbtc.com) | | [](https://ccxt.pro) |
|
||||||
| [](https://pro.hollaex.com/signup?affiliation_code=QSWA6G) | hollaex | [HollaEx](https://pro.hollaex.com/signup?affiliation_code=QSWA6G) | 1 | [API](https://apidocs.hollaex.com) | | |
|
| [](https://pro.hollaex.com/signup?affiliation_code=QSWA6G) | hollaex | [HollaEx](https://pro.hollaex.com/signup?affiliation_code=QSWA6G) | 1 | [API](https://apidocs.hollaex.com) | | |
|
||||||
| [](https://www.huobi.co.jp/register/?invite_code=znnq3) | huobijp | [Huobi Japan](https://www.huobi.co.jp/register/?invite_code=znnq3) | 1 | [API](https://api-doc.huobi.co.jp) | | [](https://ccxt.pro) |
|
| [](https://www.huobi.co.jp/register/?invite_code=znnq3) | huobijp | [Huobi Japan](https://www.huobi.co.jp/register/?invite_code=znnq3) | 1 | [API](https://api-doc.huobi.co.jp) | | [](https://ccxt.pro) |
|
||||||
| [](https://www.huobi.com/en-us/topic/invited/?invite_code=rwrd3) | huobipro | [Huobi Pro](https://www.huobi.com/en-us/topic/invited/?invite_code=rwrd3) | 1 | [API](https://huobiapi.github.io/docs/spot/v1/cn/) | | [](https://ccxt.pro) |
|
| [](https://www.huobi.com/en-us/topic/invited/?invite_code=rwrd3) | huobipro | [Huobi Pro](https://www.huobi.com/en-us/topic/invited/?invite_code=rwrd3) | 1 | [API](https://huobiapi.github.io/docs/spot/v1/cn/) | | [](https://ccxt.pro) |
|
||||||
| [](https://www.huobi.com.ru/invite?invite_code=esc74) | huobiru | [Huobi Russia](https://www.huobi.com.ru/invite?invite_code=esc74) | 1 | [API](https://github.com/cloudapidoc/API_Docs_en) | | [](https://ccxt.pro) |
|
|
||||||
| [](https://ice3x.com?ref=14341802) | ice3x | [ICE3X](https://ice3x.com?ref=14341802) | 1 | [API](https://ice3x.co.za/ice-cubed-bitcoin-exchange-api-documentation-1-june-2017) | | |
|
| [](https://ice3x.com?ref=14341802) | ice3x | [ICE3X](https://ice3x.com?ref=14341802) | 1 | [API](https://ice3x.co.za/ice-cubed-bitcoin-exchange-api-documentation-1-june-2017) | | |
|
||||||
| [](https://idex.io) | idex | [IDEX](https://idex.io) | 2 | [API](https://docs.idex.io/) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
| [](https://idex.io) | idex | [IDEX](https://idex.io) | 2 | [API](https://docs.idex.io/) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
||||||
| [](https://www.independentreserve.com) | independentreserve | [Independent Reserve](https://www.independentreserve.com) | * | [API](https://www.independentreserve.com/API) | | |
|
| [](https://www.independentreserve.com) | independentreserve | [Independent Reserve](https://www.independentreserve.com) | * | [API](https://www.independentreserve.com/API) | | |
|
||||||
@@ -143,11 +148,11 @@ The CCXT library currently supports the following 123 cryptocurrency exchange ma
|
|||||||
| [](https://latoken.com) | latoken | [Latoken](https://latoken.com) | 1 | [API](https://api.latoken.com) | | |
|
| [](https://latoken.com) | latoken | [Latoken](https://latoken.com) | 1 | [API](https://api.latoken.com) | | |
|
||||||
| [](https://www.lbex.io/invite?icode=7QCY) | lbank | [LBank](https://www.lbex.io/invite?icode=7QCY) | 1 | [API](https://github.com/LBank-exchange/lbank-official-api-docs) | | |
|
| [](https://www.lbex.io/invite?icode=7QCY) | lbank | [LBank](https://www.lbex.io/invite?icode=7QCY) | 1 | [API](https://github.com/LBank-exchange/lbank-official-api-docs) | | |
|
||||||
| [](https://www.liquid.com/sign-up/?affiliate=SbzC62lt30976) | liquid | [Liquid](https://www.liquid.com/sign-up/?affiliate=SbzC62lt30976) | 2 | [API](https://developers.liquid.com) | | |
|
| [](https://www.liquid.com/sign-up/?affiliate=SbzC62lt30976) | liquid | [Liquid](https://www.liquid.com/sign-up/?affiliate=SbzC62lt30976) | 2 | [API](https://developers.liquid.com) | | |
|
||||||
| [](https://livecoin.net/?from=Livecoin-CQ1hfx44) | livecoin | [LiveCoin](https://livecoin.net/?from=Livecoin-CQ1hfx44) | * | [API](https://www.livecoin.net/api?lang=en) | | |
|
|
||||||
| [](https://www.luno.com/invite/44893A) | luno | [luno](https://www.luno.com/invite/44893A) | 1 | [API](https://www.luno.com/en/api) | | |
|
| [](https://www.luno.com/invite/44893A) | luno | [luno](https://www.luno.com/invite/44893A) | 1 | [API](https://www.luno.com/en/api) | | |
|
||||||
| [](https://www.lykke.com) | lykke | [Lykke](https://www.lykke.com) | 1 | [API](https://hft-api.lykke.com/swagger/ui/) | | |
|
| [](https://www.lykke.com) | lykke | [Lykke](https://www.lykke.com) | 1 | [API](https://hft-api.lykke.com/swagger/ui/) | | |
|
||||||
| [](https://www.mercadobitcoin.com.br) | mercado | [Mercado Bitcoin](https://www.mercadobitcoin.com.br) | 3 | [API](https://www.mercadobitcoin.com.br/api-doc) | | |
|
| [](https://www.mercadobitcoin.com.br) | mercado | [Mercado Bitcoin](https://www.mercadobitcoin.com.br) | 3 | [API](https://www.mercadobitcoin.com.br/api-doc) | | |
|
||||||
| [](https://mixcoins.com) | mixcoins | [MixCoins](https://mixcoins.com) | 1 | [API](https://mixcoins.com/help/api/) | | |
|
| [](https://mixcoins.com) | mixcoins | [MixCoins](https://mixcoins.com) | 1 | [API](https://mixcoins.com/help/api/) | | |
|
||||||
|
| [](https://one.ndax.io/bfQiSL) | ndax | [NDAX](https://one.ndax.io/bfQiSL) | * | [API](https://apidoc.ndax.io/) | | [](https://ccxt.pro) |
|
||||||
| [](https://www.novadax.com.br/?s=ccxt) | novadax | [NovaDAX](https://www.novadax.com.br/?s=ccxt) | 1 | [API](https://doc.novadax.com/pt-BR/) | | |
|
| [](https://www.novadax.com.br/?s=ccxt) | novadax | [NovaDAX](https://www.novadax.com.br/?s=ccxt) | 1 | [API](https://doc.novadax.com/pt-BR/) | | |
|
||||||
| [](https://oceanex.pro/signup?referral=VE24QX) | oceanex | [OceanEx](https://oceanex.pro/signup?referral=VE24QX) | 1 | [API](https://api.oceanex.pro/doc/v1) | | |
|
| [](https://oceanex.pro/signup?referral=VE24QX) | oceanex | [OceanEx](https://oceanex.pro/signup?referral=VE24QX) | 1 | [API](https://api.oceanex.pro/doc/v1) | | |
|
||||||
| [](https://www.okcoin.com/account/register?flag=activity&channelId=600001513) | okcoin | [OKCoin](https://www.okcoin.com/account/register?flag=activity&channelId=600001513) | 3 | [API](https://www.okcoin.com/docs/en/) | | [](https://ccxt.pro) |
|
| [](https://www.okcoin.com/account/register?flag=activity&channelId=600001513) | okcoin | [OKCoin](https://www.okcoin.com/account/register?flag=activity&channelId=600001513) | 3 | [API](https://www.okcoin.com/docs/en/) | | [](https://ccxt.pro) |
|
||||||
@@ -166,7 +171,7 @@ The CCXT library currently supports the following 123 cryptocurrency exchange ma
|
|||||||
| [](http://bit.ly/2IX0LrM) | tidebit | [TideBit](http://bit.ly/2IX0LrM) | 2 | [API](https://www.tidebit.com/documents/api/guide) | | |
|
| [](http://bit.ly/2IX0LrM) | tidebit | [TideBit](http://bit.ly/2IX0LrM) | 2 | [API](https://www.tidebit.com/documents/api/guide) | | |
|
||||||
| [](https://tidex.com/exchange/?ref=57f5638d9cd7) | tidex | [Tidex](https://tidex.com/exchange/?ref=57f5638d9cd7) | 3 | [API](https://tidex.com/exchange/public-api) | | |
|
| [](https://tidex.com/exchange/?ref=57f5638d9cd7) | tidex | [Tidex](https://tidex.com/exchange/?ref=57f5638d9cd7) | 3 | [API](https://tidex.com/exchange/public-api) | | |
|
||||||
| [](https://timex.io/?refcode=1x27vNkTbP1uwkCck) | timex | [TimeX](https://timex.io/?refcode=1x27vNkTbP1uwkCck) | 1 | [API](https://docs.timex.io) | | |
|
| [](https://timex.io/?refcode=1x27vNkTbP1uwkCck) | timex | [TimeX](https://timex.io/?refcode=1x27vNkTbP1uwkCck) | 1 | [API](https://docs.timex.io) | | |
|
||||||
| [](https://upbit.com) | upbit | [Upbit](https://upbit.com) | 1 | [API](https://docs.upbit.com/docs/%EC%9A%94%EC%B2%AD-%EC%88%98-%EC%A0%9C%ED%95%9C) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
| [](https://upbit.com) | upbit | [Upbit](https://upbit.com) | 1 | [API](https://docs.upbit.com/docs/%EC%9A%94%EC%B2%AD-%EC%88%98-%EC%A0%9C%ED%95%9C) | | [](https://ccxt.pro) |
|
||||||
| [](https://www.vaultoro.com) | vaultoro | [Vaultoro](https://www.vaultoro.com) | 1 | [API](https://api.vaultoro.com) | | |
|
| [](https://www.vaultoro.com) | vaultoro | [Vaultoro](https://www.vaultoro.com) | 1 | [API](https://api.vaultoro.com) | | |
|
||||||
| [](https://vbtc.exchange) | vbtc | [VBTC](https://vbtc.exchange) | 1 | [API](https://blinktrade.com/docs) | | |
|
| [](https://vbtc.exchange) | vbtc | [VBTC](https://vbtc.exchange) | 1 | [API](https://blinktrade.com/docs) | | |
|
||||||
| [](https://vcc.exchange?ref=l4xhrH) | vcc | [VCC Exchange](https://vcc.exchange?ref=l4xhrH) | 3 | [API](https://vcc.exchange/api) | | |
|
| [](https://vcc.exchange?ref=l4xhrH) | vcc | [VCC Exchange](https://vcc.exchange?ref=l4xhrH) | 3 | [API](https://vcc.exchange/api) | | |
|
||||||
@@ -224,13 +229,13 @@ console.log (ccxt.exchanges) // print all available exchanges
|
|||||||
|
|
||||||
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
||||||
|
|
||||||
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@1.38.76/dist/ccxt.browser.js
|
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@1.42.67/dist/ccxt.browser.js
|
||||||
* unpkg: https://unpkg.com/ccxt@1.38.76/dist/ccxt.browser.js
|
* unpkg: https://unpkg.com/ccxt@1.42.67/dist/ccxt.browser.js
|
||||||
|
|
||||||
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
||||||
|
|
||||||
```HTML
|
```HTML
|
||||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@1.38.76/dist/ccxt.browser.js"></script>
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@1.42.67/dist/ccxt.browser.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
Creates a global `ccxt` object:
|
Creates a global `ccxt` object:
|
||||||
@@ -275,6 +280,8 @@ include "ccxt.php";
|
|||||||
var_dump (\ccxt\Exchange::$exchanges); // print a list of all available exchange classes
|
var_dump (\ccxt\Exchange::$exchanges); // print a list of all available exchange classes
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The library supports concurrent asynchronous mode using tools from [RecoilPHP](https://github.com/recoilphp/recoil) and [ReactPHP](https://reactphp.org/) in PHP 7.1+. Read the [Manual](https://github.com/ccxt/ccxt/wiki) for more details.
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
You can get CCXT installed in a container along with all the supported languages and dependencies. This may be useful if you want to contribute to CCXT (e.g. run the build scripts and tests — please see the [Contributing](https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md) document for the details on that).
|
You can get CCXT installed in a container along with all the supported languages and dependencies. This may be useful if you want to contribute to CCXT (e.g. run the build scripts and tests — please see the [Contributing](https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md) document for the details on that).
|
||||||
@@ -529,15 +536,6 @@ Thank you to all our backers! [[Become a backer](https://opencollective.com/ccxt
|
|||||||
|
|
||||||
<a href="https://opencollective.com/ccxt#backers" target="_blank"><img src="https://opencollective.com/ccxt/tiers/backer.svg?width=890"></a>
|
<a href="https://opencollective.com/ccxt#backers" target="_blank"><img src="https://opencollective.com/ccxt/tiers/backer.svg?width=890"></a>
|
||||||
|
|
||||||
### Crypto
|
|
||||||
|
|
||||||
```
|
|
||||||
ETH 0x26a3CB49578F07000575405a57888681249c35Fd (ETH only)
|
|
||||||
BTC 33RmVRfhK2WZVQR1R83h2e9yXoqRNDvJva
|
|
||||||
BCH 1GN9p233TvNcNQFthCgfiHUnj5JRKEc2Ze
|
|
||||||
LTC LgM5hkvPzytEFfQGGDFGKYkE743jwUA7qv
|
|
||||||
```
|
|
||||||
|
|
||||||
Thank you!
|
Thank you!
|
||||||
|
|
||||||
## Social
|
## Social
|
||||||
|
|||||||
Projects/Superalgos/TS/Bot-Modules/Sensor-Bot/Exchange-Raw-Data/node_modules/ccxt/build/transpile.js
Generated
Vendored
+188
-98
@@ -274,6 +274,7 @@ class Transpiler {
|
|||||||
[ /(?<=[^\s#]) \]/g, ']' ], // PEP8 E202 remove whitespaces before right ] square bracket
|
[ /(?<=[^\s#]) \]/g, ']' ], // PEP8 E202 remove whitespaces before right ] square bracket
|
||||||
[ /(?<=[^\s#]) \}/g, '}' ], // PEP8 E202 remove whitespaces before right } bracket
|
[ /(?<=[^\s#]) \}/g, '}' ], // PEP8 E202 remove whitespaces before right } bracket
|
||||||
[ /([^a-z])(elif|if|or|else)\(/g, '$1$2 \(' ], // a correction for PEP8 E225 side-effect for compound and ternary conditionals
|
[ /([^a-z])(elif|if|or|else)\(/g, '$1$2 \(' ], // a correction for PEP8 E225 side-effect for compound and ternary conditionals
|
||||||
|
[ /\!\=\sTrue/g, 'is not True' ], // a correction for PEP8 E712, it likes "is not True", not "!= True"
|
||||||
[ /\=\=\sTrue/g, 'is True' ], // a correction for PEP8 E712, it likes "is True", not "== True"
|
[ /\=\=\sTrue/g, 'is True' ], // a correction for PEP8 E712, it likes "is True", not "== True"
|
||||||
[ /\sdelete\s/g, ' del ' ],
|
[ /\sdelete\s/g, ' del ' ],
|
||||||
[ /(?<!#.+)null/, 'None' ],
|
[ /(?<!#.+)null/, 'None' ],
|
||||||
@@ -286,6 +287,12 @@ class Transpiler {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSyncPHPRegexes () {
|
||||||
|
return [
|
||||||
|
[ /\byield /g, '' ]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
getPHPRegexes () {
|
getPHPRegexes () {
|
||||||
return [
|
return [
|
||||||
[ /\{([a-zA-Z0-9_-]+?)\}/g, '~$1~' ], // resolve the "arrays vs url params" conflict (both are in {}-brackets)
|
[ /\{([a-zA-Z0-9_-]+?)\}/g, '~$1~' ], // resolve the "arrays vs url params" conflict (both are in {}-brackets)
|
||||||
@@ -359,7 +366,7 @@ class Transpiler {
|
|||||||
[ /for\s+\(([a-zA-Z0-9_]+)\s*=\s*([^\;\s]+\s*)\;[^\<\>\=]+(\<=|\>=|<|>)\s*(.*)\s*\;([^\)]+)\)\s*{/g, 'for ($1 = $2; $1 $3 $4;$5) {' ],
|
[ /for\s+\(([a-zA-Z0-9_]+)\s*=\s*([^\;\s]+\s*)\;[^\<\>\=]+(\<=|\>=|<|>)\s*(.*)\s*\;([^\)]+)\)\s*{/g, 'for ($1 = $2; $1 $3 $4;$5) {' ],
|
||||||
[ /([^\s]+)\.length\;/g, 'is_array($1) ? count($1) : 0;' ],
|
[ /([^\s]+)\.length\;/g, 'is_array($1) ? count($1) : 0;' ],
|
||||||
[ /\.push\s*\(([\s\S]+?)\)\;/g, '[] = $1;' ],
|
[ /\.push\s*\(([\s\S]+?)\)\;/g, '[] = $1;' ],
|
||||||
[ /(\s)await(\s)/g, '$1' ],
|
[ /(\b)await(\b)/g, 'yield' ],
|
||||||
[ /([\S])\: /g, '$1 => ' ],
|
[ /([\S])\: /g, '$1 => ' ],
|
||||||
|
|
||||||
// add {}-array syntax conversions up to 20 levels deep
|
// add {}-array syntax conversions up to 20 levels deep
|
||||||
@@ -441,7 +448,7 @@ class Transpiler {
|
|||||||
"import os",
|
"import os",
|
||||||
"import sys",
|
"import sys",
|
||||||
"",
|
"",
|
||||||
"root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))",
|
"root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))",
|
||||||
"sys.path.append(root)",
|
"sys.path.append(root)",
|
||||||
"",
|
"",
|
||||||
"# ----------------------------------------------------------------------------",
|
"# ----------------------------------------------------------------------------",
|
||||||
@@ -598,11 +605,11 @@ class Transpiler {
|
|||||||
return 'class ' + className + ' extends ' + baseClass + ' {'
|
return 'class ' + className + ' extends ' + baseClass + ' {'
|
||||||
}
|
}
|
||||||
|
|
||||||
createPHPClassHeader (className, baseClass, bodyAsString) {
|
createPHPClassHeader (className, baseClass, bodyAsString, namespace) {
|
||||||
return [
|
return [
|
||||||
"<?php",
|
"<?php",
|
||||||
"",
|
"",
|
||||||
"namespace ccxt;",
|
"namespace " + namespace + ";",
|
||||||
"",
|
"",
|
||||||
"// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:",
|
"// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:",
|
||||||
"// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code",
|
"// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code",
|
||||||
@@ -611,11 +618,11 @@ class Transpiler {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
createPHPClass (className, baseClass, body, methods) {
|
createPHPClass (className, baseClass, body, methods, async = false) {
|
||||||
|
|
||||||
let bodyAsString = body.join ("\n")
|
let bodyAsString = body.join ("\n")
|
||||||
|
|
||||||
let header = this.createPHPClassHeader (className, baseClass, bodyAsString)
|
let header = this.createPHPClassHeader (className, baseClass, bodyAsString, async ? 'ccxt\\async' : 'ccxt')
|
||||||
|
|
||||||
const errorImports = []
|
const errorImports = []
|
||||||
|
|
||||||
@@ -693,6 +700,15 @@ class Transpiler {
|
|||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
transpileAsyncPHPToSyncPHP (php) {
|
||||||
|
|
||||||
|
// remove yield from php body
|
||||||
|
return this.regexAll (php, this.getSyncPHPRegexes ())
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
transpileJavaScriptToPHP ({ js, variables }) {
|
transpileJavaScriptToPHP ({ js, variables }) {
|
||||||
|
|
||||||
// match all local variables (let, const or var)
|
// match all local variables (let, const or var)
|
||||||
@@ -756,32 +772,35 @@ class Transpiler {
|
|||||||
// remove await from Python 2 body (transpile Python 3 → Python 2)
|
// remove await from Python 2 body (transpile Python 3 → Python 2)
|
||||||
let python2Body = this.transpilePython3ToPython2 (python3Body)
|
let python2Body = this.transpilePython3ToPython2 (python3Body)
|
||||||
|
|
||||||
// transpile JS → PHP
|
// transpile JS → Async PHP
|
||||||
let phpBody = this.transpileJavaScriptToPHP (args)
|
let phpAsyncBody = this.transpileJavaScriptToPHP (args)
|
||||||
|
|
||||||
return { python3Body, python2Body, phpBody }
|
// transpile async PHP -> sync PHP
|
||||||
|
let phpBody = this.transpileAsyncPHPToSyncPHP (phpAsyncBody)
|
||||||
|
|
||||||
|
return { python3Body, python2Body, phpBody, phpAsyncBody }
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
transpilePythonAsyncToSync () {
|
transpilePythonAsyncToSync () {
|
||||||
|
|
||||||
const async = './python/test/test_async.py'
|
const async = './python/ccxt/test/test_async.py'
|
||||||
const sync = './python/test/test.py'
|
const sync = './python/ccxt/test/test_sync.py'
|
||||||
log.magenta ('Transpiling ' + async .yellow + ' → ' + sync.yellow)
|
log.magenta ('Transpiling ' + async .yellow + ' → ' + sync.yellow)
|
||||||
const fileContents = fs.readFileSync (async, 'utf8')
|
const fileContents = fs.readFileSync (async, 'utf8')
|
||||||
let lines = fileContents.split ("\n")
|
let lines = fileContents.split ("\n")
|
||||||
|
|
||||||
lines = lines.filter (line => ![ 'import asyncio' ].includes (line))
|
lines = lines.filter (line => ![ 'import asyncio' ].includes (line))
|
||||||
.map (line => {
|
.map (line => {
|
||||||
return (
|
return (
|
||||||
line.replace ('asyncio.get_event_loop().run_until_complete(main())', 'main()')
|
line.replace ('asyncio.get_event_loop().run_until_complete(main())', 'main()')
|
||||||
.replace ('import ccxt.async_support as ccxt', 'import ccxt')
|
.replace ('import ccxt.async_support as ccxt', 'import ccxt')
|
||||||
.replace (/.*token\_bucket.*/g, '')
|
.replace (/.*token\_bucket.*/g, '')
|
||||||
.replace ('await asyncio.sleep', 'time.sleep')
|
.replace ('await asyncio.sleep', 'time.sleep')
|
||||||
.replace ('async ', '')
|
.replace ('async ', '')
|
||||||
.replace ('await ', ''))
|
.replace ('await ', ''))
|
||||||
})
|
})
|
||||||
|
|
||||||
// lines.forEach (line => log (line))
|
// lines.forEach (line => log (line))
|
||||||
|
|
||||||
@@ -803,22 +822,47 @@ class Transpiler {
|
|||||||
fs.writeFileSync (sync, newContents)
|
fs.writeFileSync (sync, newContents)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
transpilePhpAsyncToSync () {
|
||||||
|
|
||||||
|
const async = './php/test/test_async.php'
|
||||||
|
const sync = './php/test/test_sync.php'
|
||||||
|
log.magenta ('Transpiling ' + async .yellow + ' → ' + sync.yellow)
|
||||||
|
const fileContents = fs.readFileSync (async, 'utf8')
|
||||||
|
const syncBody = this.transpileAsyncPHPToSyncPHP (fileContents)
|
||||||
|
|
||||||
|
const phpSyncRegexes = [
|
||||||
|
[ /\$kernel->execute\(\$main\)/, '\$main()' ],
|
||||||
|
[ /\$kernel->run\(\);\n/, '' ],
|
||||||
|
[ /\$kernel = async\\Exchange::get_kernel\(\);\n/, '' ],
|
||||||
|
[ /ccxt\\\\async/, 'ccxt' ],
|
||||||
|
]
|
||||||
|
|
||||||
|
const newContents = this.regexAll (syncBody, phpSyncRegexes)
|
||||||
|
|
||||||
|
fs.truncateSync (sync)
|
||||||
|
fs.writeFileSync (sync, newContents)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
getExchangeClassDeclarationMatches (contents) {
|
||||||
|
return contents.match (/^module\.exports\s*=\s*class\s+([\S]+)\s+extends\s+([\S]+)\s+{([\s\S]+?)^};*/m)
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
transpileDerivedExchangeClass (contents, methodNames = undefined) {
|
transpileDerivedExchangeClass (contents, methodNames = undefined) {
|
||||||
|
|
||||||
let exchangeClassDeclarationMatches = contents.match (/^module\.exports\s*=\s*class\s+([\S]+)\s+extends\s+([\S]+)\s+{([\s\S]+?)^};*/m)
|
const [ _, className, baseClass, methodMatches ] = this.getExchangeClassDeclarationMatches (contents)
|
||||||
|
|
||||||
// log.green (file, exchangeClassDeclarationMatches[3])
|
const methods = methodMatches.trim ().split (/\n\s*\n/)
|
||||||
|
|
||||||
let className = exchangeClassDeclarationMatches[1]
|
|
||||||
let baseClass = exchangeClassDeclarationMatches[2]
|
|
||||||
|
|
||||||
let methods = exchangeClassDeclarationMatches[3].trim ().split (/\n\s*\n/)
|
|
||||||
|
|
||||||
let python2 = []
|
let python2 = []
|
||||||
let python3 = []
|
let python3 = []
|
||||||
let php = []
|
let php = []
|
||||||
|
let phpAsync = []
|
||||||
|
|
||||||
methodNames = [] // methodNames || []
|
methodNames = [] // methodNames || []
|
||||||
|
|
||||||
@@ -838,14 +882,6 @@ class Transpiler {
|
|||||||
|
|
||||||
// async or not
|
// async or not
|
||||||
let keyword = matches[1]
|
let keyword = matches[1]
|
||||||
// try {
|
|
||||||
// keyword = matches[1]
|
|
||||||
// } catch (e) {
|
|
||||||
// log.red (e)
|
|
||||||
// log.green (methods[i])
|
|
||||||
// log.yellow (exchangeClassDeclarationMatches[3].trim ().split (/\n\s*\n/))
|
|
||||||
// process.exit ()
|
|
||||||
// }
|
|
||||||
|
|
||||||
// method name
|
// method name
|
||||||
let method = matches[2]
|
let method = matches[2]
|
||||||
@@ -869,17 +905,17 @@ class Transpiler {
|
|||||||
|
|
||||||
// remove excessive spacing from argument defaults in Python method signature
|
// remove excessive spacing from argument defaults in Python method signature
|
||||||
let pythonArgs = args.map (x => x.replace (' = ', '='))
|
let pythonArgs = args.map (x => x.replace (' = ', '='))
|
||||||
.join (', ')
|
.join (', ')
|
||||||
.replace (/undefined/g, 'None')
|
.replace (/undefined/g, 'None')
|
||||||
.replace (/false/g, 'False')
|
.replace (/false/g, 'False')
|
||||||
.replace (/true/g, 'True')
|
.replace (/true/g, 'True')
|
||||||
|
|
||||||
// method body without the signature (first line)
|
// method body without the signature (first line)
|
||||||
// and without the closing bracket (last line)
|
// and without the closing bracket (last line)
|
||||||
let js = lines.slice (1, -1).join ("\n")
|
let js = lines.slice (1, -1).join ("\n")
|
||||||
|
|
||||||
// transpile everything
|
// transpile everything
|
||||||
let { python3Body, python2Body, phpBody } = this.transpileJavaScriptToPythonAndPHP ({ js, className, variables, removeEmptyLines: true })
|
let { python3Body, python2Body, phpBody, phpAsyncBody } = this.transpileJavaScriptToPythonAndPHP ({ js, className, variables, removeEmptyLines: true })
|
||||||
|
|
||||||
// compile the final Python code for the method signature
|
// compile the final Python code for the method signature
|
||||||
let pythonString = 'def ' + method + '(self' + (pythonArgs.length ? ', ' + pythonArgs : '') + '):'
|
let pythonString = 'def ' + method + '(self' + (pythonArgs.length ? ', ' + pythonArgs : '') + '):'
|
||||||
@@ -900,14 +936,19 @@ class Transpiler {
|
|||||||
php.push (phpBody);
|
php.push (phpBody);
|
||||||
php.push (' }')
|
php.push (' }')
|
||||||
|
|
||||||
|
phpAsync.push ('');
|
||||||
|
phpAsync.push (' public function ' + method + '(' + phpArgs + ') {');
|
||||||
|
phpAsync.push (phpAsyncBody);
|
||||||
|
phpAsync.push (' }')
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
// altogether in PHP, Python 2 and 3 (async)
|
// altogether in PHP, async PHP, Python 2 and 3 (async)
|
||||||
python2: this.createPythonClass (className, baseClass, python2, methodNames),
|
python2: this.createPythonClass (className, baseClass, python2, methodNames),
|
||||||
python3: this.createPythonClass (className, baseClass, python3, methodNames, true),
|
python3: this.createPythonClass (className, baseClass, python3, methodNames, true),
|
||||||
php: this.createPHPClass (className, baseClass, php, methodNames),
|
php: this.createPHPClass (className, baseClass, php, methodNames),
|
||||||
|
phpAsync: this.createPHPClass (className, baseClass, phpAsync, methodNames, true),
|
||||||
|
|
||||||
className,
|
className,
|
||||||
baseClass,
|
baseClass,
|
||||||
@@ -916,46 +957,58 @@ class Transpiler {
|
|||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
|
||||||
transpileDerivedExchangeFile (jsFolder, filename, options) {
|
transpileDerivedExchangeFile (jsFolder, filename, options, force = false) {
|
||||||
|
|
||||||
// todo normalize jsFolder and other arguments
|
// todo normalize jsFolder and other arguments
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const { python2Folder, python3Folder, phpFolder } = options
|
const { python2Folder, python3Folder, phpFolder, phpAsyncFolder } = options
|
||||||
const path = jsFolder + filename
|
const pythonFilename = filename.replace ('.js', '.py')
|
||||||
const contents = fs.readFileSync (path, 'utf8')
|
const phpFilename = filename.replace ('.js', '.php')
|
||||||
|
|
||||||
// function getMethodNames (object) {
|
const jsMtime = fs.statSync (jsFolder + filename).mtime.getTime ()
|
||||||
// let functions = []
|
|
||||||
// let o = object
|
|
||||||
// do {
|
|
||||||
// functions = functions.concat (Object.getOwnPropertyNames (o))
|
|
||||||
// } while (o = Object.getPrototypeOf (o))
|
|
||||||
// return unique (functions.filter (f => (typeof object[f] === 'function')))
|
|
||||||
// }
|
|
||||||
// const exchangeClass = require ('.' + path)
|
|
||||||
// const exchange = new exchangeClass ()
|
|
||||||
// const methodNames = getMethodNames (exchange)
|
|
||||||
// const { python2, python3, php, className, baseClass } =
|
|
||||||
// this.transpileDerivedExchangeClass (contents, methodNames)
|
|
||||||
|
|
||||||
const { python2, python3, php, className, baseClass } =
|
const python2Path = python2Folder ? (python2Folder + pythonFilename) : undefined
|
||||||
this.transpileDerivedExchangeClass (contents)
|
const python3Path = python3Folder ? (python3Folder + pythonFilename) : undefined
|
||||||
|
const phpPath = phpFolder ? (phpFolder + phpFilename) : undefined
|
||||||
|
const phpAsyncPath = phpAsyncFolder ? (phpAsyncFolder + phpFilename) : undefined
|
||||||
|
|
||||||
log.cyan ('Transpiling from', filename.yellow)
|
const python2Mtime = python2Folder ? (fs.existsSync (python2Path) ? fs.statSync (python2Path).mtime.getTime () : 0) : undefined
|
||||||
|
const python3Mtime = python3Path ? (fs.existsSync (python3Path) ? fs.statSync (python3Path).mtime.getTime () : 0) : undefined
|
||||||
|
const phpAsyncMtime = phpAsyncFolder ? (fs.existsSync (phpAsyncPath) ? fs.statSync (phpAsyncPath).mtime.getTime () : 0) : undefined
|
||||||
|
const phpMtime = phpPath ? (fs.existsSync (phpPath) ? fs.statSync (phpPath).mtime.getTime () : 0) : undefined
|
||||||
|
|
||||||
;[
|
const contents = fs.readFileSync (jsFolder + filename, 'utf8')
|
||||||
[ python2Folder, filename.replace ('.js', '.py'), python2 ],
|
|
||||||
[ python3Folder, filename.replace ('.js', '.py'), python3 ],
|
|
||||||
[ phpFolder, filename.replace ('.js', '.php'), php ],
|
|
||||||
].forEach (([ folder, filename, code ]) => {
|
|
||||||
if (folder) {
|
|
||||||
overwriteFile (folder + filename, code)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return { className, baseClass }
|
if (force ||
|
||||||
|
(python3Folder && (jsMtime > python3Mtime)) ||
|
||||||
|
(phpFolder && (jsMtime > phpMtime)) ||
|
||||||
|
(phpAsyncFolder && (jsMtime > phpAsyncMtime)) ||
|
||||||
|
(python2Folder && (jsMtime > python2Mtime))) {
|
||||||
|
const { python2, python3, php, phpAsync, className, baseClass } = this.transpileDerivedExchangeClass (contents)
|
||||||
|
log.cyan ('Transpiling from', filename.yellow)
|
||||||
|
|
||||||
|
;[
|
||||||
|
[ python2Folder, pythonFilename, python2 ],
|
||||||
|
[ python3Folder, pythonFilename, python3 ],
|
||||||
|
[ phpFolder, phpFilename, php ],
|
||||||
|
[ phpAsyncFolder, phpFilename, phpAsync ],
|
||||||
|
].forEach (([ folder, filename, code ]) => {
|
||||||
|
if (folder) {
|
||||||
|
overwriteFile (folder + filename, code)
|
||||||
|
fs.utimesSync (folder + filename, new Date (), new Date (jsMtime))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return { className, baseClass }
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
const [ _, className, baseClass ] = this.getExchangeClassDeclarationMatches (contents)
|
||||||
|
log.green ('Already transpiled', filename.yellow)
|
||||||
|
return { className, baseClass }
|
||||||
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
@@ -967,11 +1020,11 @@ class Transpiler {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
transpileDerivedExchangeFiles (jsFolder, options, pattern = '.js') {
|
transpileDerivedExchangeFiles (jsFolder, options, pattern = '.js', force = false) {
|
||||||
|
|
||||||
// todo normalize jsFolder and other arguments
|
// todo normalize jsFolder and other arguments
|
||||||
|
|
||||||
const { python2Folder, python3Folder, phpFolder } = options
|
const { python2Folder, python3Folder, phpFolder, phpAsyncFolder } = options
|
||||||
|
|
||||||
// exchanges.json accounts for ids included in exchanges.cfg
|
// exchanges.json accounts for ids included in exchanges.cfg
|
||||||
let ids = undefined
|
let ids = undefined
|
||||||
@@ -984,7 +1037,7 @@ class Transpiler {
|
|||||||
|
|
||||||
const classNames = fs.readdirSync (jsFolder)
|
const classNames = fs.readdirSync (jsFolder)
|
||||||
.filter (file => file.match (regex) && (!ids || ids.includes (basename (file, '.js'))))
|
.filter (file => file.match (regex) && (!ids || ids.includes (basename (file, '.js'))))
|
||||||
.map (file => this.transpileDerivedExchangeFile (jsFolder, file, options))
|
.map (file => this.transpileDerivedExchangeFile (jsFolder, file, options, force))
|
||||||
|
|
||||||
const classes = {}
|
const classes = {}
|
||||||
|
|
||||||
@@ -1013,6 +1066,7 @@ class Transpiler {
|
|||||||
[ python2Folder, /\.pyc?$/ ],
|
[ python2Folder, /\.pyc?$/ ],
|
||||||
[ python3Folder, /\.pyc?$/ ],
|
[ python3Folder, /\.pyc?$/ ],
|
||||||
[ phpFolder, /\.php$/ ],
|
[ phpFolder, /\.php$/ ],
|
||||||
|
[ phpAsyncFolder, /\.php$/ ],
|
||||||
].forEach (([ folder, pattern ]) => {
|
].forEach (([ folder, pattern ]) => {
|
||||||
if (folder) {
|
if (folder) {
|
||||||
deleteOldTranspiledFiles (folder, pattern)
|
deleteOldTranspiledFiles (folder, pattern)
|
||||||
@@ -1092,7 +1146,7 @@ class Transpiler {
|
|||||||
|
|
||||||
const quote = (s) => "'" + s + "'" // helper to add quotes around class names
|
const quote = (s) => "'" + s + "'" // helper to add quotes around class names
|
||||||
|
|
||||||
const pythonExports = [ 'error_hierarchy' ]
|
const pythonExports = [ 'error_hierarchy', 'BaseError' ]
|
||||||
const pythonErrors = intellisense (root, 'BaseError', pythonDeclareErrorClass, pythonExports)
|
const pythonErrors = intellisense (root, 'BaseError', pythonDeclareErrorClass, pythonExports)
|
||||||
const pythonAll = '__all__ = [\n ' + pythonExports.map (quote).join (',\n ') + '\n]'
|
const pythonAll = '__all__ = [\n ' + pythonExports.map (quote).join (',\n ') + '\n]'
|
||||||
|
|
||||||
@@ -1157,7 +1211,7 @@ class Transpiler {
|
|||||||
|
|
||||||
transpileDateTimeTests () {
|
transpileDateTimeTests () {
|
||||||
const jsFile = './js/test/base/functions/test.datetime.js'
|
const jsFile = './js/test/base/functions/test.datetime.js'
|
||||||
const pyFile = './python/test/test_exchange_datetime_functions.py'
|
const pyFile = './python/ccxt/test/test_exchange_datetime_functions.py'
|
||||||
const phpFile = './php/test/test_exchange_datetime_functions.php'
|
const phpFile = './php/test/test_exchange_datetime_functions.php'
|
||||||
|
|
||||||
log.magenta ('Transpiling from', jsFile.yellow)
|
log.magenta ('Transpiling from', jsFile.yellow)
|
||||||
@@ -1169,7 +1223,7 @@ class Transpiler {
|
|||||||
[/^\/\*.*\s+/mg, ''],
|
[/^\/\*.*\s+/mg, ''],
|
||||||
])
|
])
|
||||||
|
|
||||||
let { python3Body, python2Body, phpBody } = this.transpileJavaScriptToPythonAndPHP ({ js, removeEmptyLines: false })
|
let { python3Body, python2Body, phpBody, phpAsyncBody } = this.transpileJavaScriptToPythonAndPHP ({ js, removeEmptyLines: false })
|
||||||
|
|
||||||
// phpBody = phpBody.replace (/exchange\./g, 'Exchange::')
|
// phpBody = phpBody.replace (/exchange\./g, 'Exchange::')
|
||||||
|
|
||||||
@@ -1198,7 +1252,7 @@ class Transpiler {
|
|||||||
transpilePrecisionTests () {
|
transpilePrecisionTests () {
|
||||||
|
|
||||||
const jsFile = './js/test/base/functions/test.number.js'
|
const jsFile = './js/test/base/functions/test.number.js'
|
||||||
const pyFile = './python/test/test_decimal_to_precision.py'
|
const pyFile = './python/ccxt/test/test_decimal_to_precision.py'
|
||||||
const phpFile = './php/test/decimal_to_precision.php'
|
const phpFile = './php/test/decimal_to_precision.php'
|
||||||
|
|
||||||
log.magenta ('Transpiling from', jsFile.yellow)
|
log.magenta ('Transpiling from', jsFile.yellow)
|
||||||
@@ -1212,7 +1266,7 @@ class Transpiler {
|
|||||||
[ /numberToString/g, 'number_to_string' ],
|
[ /numberToString/g, 'number_to_string' ],
|
||||||
])
|
])
|
||||||
|
|
||||||
let { python3Body, python2Body, phpBody } = this.transpileJavaScriptToPythonAndPHP ({ js, removeEmptyLines: false })
|
let { python3Body, python2Body, phpBody, phpAsyncBody } = this.transpileJavaScriptToPythonAndPHP ({ js, removeEmptyLines: false })
|
||||||
|
|
||||||
const pythonHeader = [
|
const pythonHeader = [
|
||||||
"",
|
"",
|
||||||
@@ -1283,7 +1337,7 @@ class Transpiler {
|
|||||||
|
|
||||||
transpileCryptoTests () {
|
transpileCryptoTests () {
|
||||||
const jsFile = './js/test/base/functions/test.crypto.js'
|
const jsFile = './js/test/base/functions/test.crypto.js'
|
||||||
const pyFile = './python/test/test_crypto.py'
|
const pyFile = './python/ccxt/test/test_crypto.py'
|
||||||
const phpFile = './php/test/test_crypto.php'
|
const phpFile = './php/test/test_crypto.php'
|
||||||
|
|
||||||
log.magenta ('Transpiling from', jsFile.yellow)
|
log.magenta ('Transpiling from', jsFile.yellow)
|
||||||
@@ -1295,7 +1349,7 @@ class Transpiler {
|
|||||||
[ /function equals \([\S\s]+?return true\n}\n/g, '' ],
|
[ /function equals \([\S\s]+?return true\n}\n/g, '' ],
|
||||||
])
|
])
|
||||||
|
|
||||||
let { python3Body, python2Body, phpBody } = this.transpileJavaScriptToPythonAndPHP ({ js, removeEmptyLines: false })
|
let { python3Body, python2Body, phpBody, phpAsyncBody } = this.transpileJavaScriptToPythonAndPHP ({ js, removeEmptyLines: false })
|
||||||
|
|
||||||
const pythonHeader = [
|
const pythonHeader = [
|
||||||
"",
|
"",
|
||||||
@@ -1352,22 +1406,22 @@ class Transpiler {
|
|||||||
const tests = [
|
const tests = [
|
||||||
{
|
{
|
||||||
'jsFile': './js/test/Exchange/test.trade.js',
|
'jsFile': './js/test/Exchange/test.trade.js',
|
||||||
'pyFile': './python/test/test_trade.py',
|
'pyFile': './python/ccxt/test/test_trade.py',
|
||||||
'phpFile': './php/test/test_trade.php',
|
'phpFile': './php/test/test_trade.php',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'jsFile': './js/test/Exchange/test.order.js',
|
'jsFile': './js/test/Exchange/test.order.js',
|
||||||
'pyFile': './python/test/test_order.py',
|
'pyFile': './python/ccxt/test/test_order.py',
|
||||||
'phpFile': './php/test/test_order.php',
|
'phpFile': './php/test/test_order.php',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'jsFile': './js/test/Exchange/test.transaction.js',
|
'jsFile': './js/test/Exchange/test.transaction.js',
|
||||||
'pyFile': './python/test/test_transaction.py',
|
'pyFile': './python/ccxt/test/test_transaction.py',
|
||||||
'phpFile': './php/test/test_transaction.php',
|
'phpFile': './php/test/test_transaction.php',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'jsFile': './js/test/Exchange/test.ohlcv.js',
|
'jsFile': './js/test/Exchange/test.ohlcv.js',
|
||||||
'pyFile': './python/test/test_ohlcv.py',
|
'pyFile': './python/ccxt/test/test_ohlcv.py',
|
||||||
'phpFile': './php/test/test_ohlcv.php',
|
'phpFile': './php/test/test_ohlcv.php',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -1389,7 +1443,6 @@ class Transpiler {
|
|||||||
])
|
])
|
||||||
|
|
||||||
const pythonHeader = [
|
const pythonHeader = [
|
||||||
'',
|
|
||||||
'import numbers # noqa: E402',
|
'import numbers # noqa: E402',
|
||||||
'try:',
|
'try:',
|
||||||
' basestring # basestring was removed in Python 3',
|
' basestring # basestring was removed in Python 3',
|
||||||
@@ -1400,7 +1453,7 @@ class Transpiler {
|
|||||||
].join('\n')
|
].join('\n')
|
||||||
|
|
||||||
let { python3Body, python2Body, phpBody } = this.transpileJavaScriptToPythonAndPHP ({ js, removeEmptyLines: false })
|
let { python3Body, python2Body, phpBody } = this.transpileJavaScriptToPythonAndPHP ({ js, removeEmptyLines: false })
|
||||||
const python = this.getPythonPreamble () + pythonHeader + python3Body;
|
const python = pythonHeader + python3Body;
|
||||||
const php = this.getPHPPreamble (false) + phpBody;
|
const php = this.getPHPPreamble (false) + phpBody;
|
||||||
|
|
||||||
log.magenta ('→', test.pyFile.yellow)
|
log.magenta ('→', test.pyFile.yellow)
|
||||||
@@ -1423,22 +1476,53 @@ class Transpiler {
|
|||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
transpileEverything () {
|
transpilePhpBaseClassMethods () {
|
||||||
|
const baseMethods = this.getPHPBaseMethods ()
|
||||||
|
const indent = 4
|
||||||
|
const space = ' '.repeat (indent)
|
||||||
|
const result = [
|
||||||
|
'public static $camelcase_methods = array(',
|
||||||
|
]
|
||||||
|
for (const method of baseMethods) {
|
||||||
|
const underscoreCase = unCamelCase (method)
|
||||||
|
if (underscoreCase !== method) {
|
||||||
|
result.push (space.repeat (2) + '\'' + method + '\' => ' + '\'' + underscoreCase + '\',')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.push (space + ');')
|
||||||
|
const string = result.join ('\n')
|
||||||
|
|
||||||
|
const phpBaseClass = './php/base/Exchange.php';
|
||||||
|
const phpBody = fs.readFileSync (phpBaseClass, 'utf8')
|
||||||
|
const regex = /public static \$camelcase_methods = array\([\s\S]+?\);/g
|
||||||
|
const bodyArray = phpBody.split (regex)
|
||||||
|
|
||||||
|
const newBody = bodyArray[0] + string + bodyArray[1]
|
||||||
|
|
||||||
|
log.magenta ('Transpiling from ', phpBaseClass.yellow, '→', phpBaseClass.yellow)
|
||||||
|
overwriteFile (phpBaseClass, newBody)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
transpileEverything (force = false) {
|
||||||
|
|
||||||
// default pattern is '.js'
|
// default pattern is '.js'
|
||||||
const [ /* node */, /* script */, pattern ] = process.argv
|
const [ /* node */, /* script */, pattern ] = process.argv.filter (x => !x.startsWith ('--'))
|
||||||
, python2Folder = './python/ccxt/'
|
, python2Folder = './python/ccxt/'
|
||||||
, python3Folder = './python/ccxt/async_support/'
|
, python3Folder = './python/ccxt/async_support/'
|
||||||
, phpFolder = './php/'
|
, phpFolder = './php/'
|
||||||
, options = { python2Folder, python3Folder, phpFolder }
|
, phpAsyncFolder = './php/async/'
|
||||||
|
, options = { python2Folder, python3Folder, phpFolder, phpAsyncFolder }
|
||||||
|
|
||||||
createFolderRecursively (python2Folder)
|
createFolderRecursively (python2Folder)
|
||||||
createFolderRecursively (python3Folder)
|
createFolderRecursively (python3Folder)
|
||||||
createFolderRecursively (phpFolder)
|
createFolderRecursively (phpFolder)
|
||||||
|
createFolderRecursively (phpAsyncFolder)
|
||||||
|
|
||||||
//*
|
//*
|
||||||
|
|
||||||
const classes = this.transpileDerivedExchangeFiles ('./js/', options, pattern)
|
const classes = this.transpileDerivedExchangeFiles ('./js/', options, pattern, force)
|
||||||
|
|
||||||
if (classes === null) {
|
if (classes === null) {
|
||||||
log.bright.yellow ('0 files transpiled.')
|
log.bright.yellow ('0 files transpiled.')
|
||||||
@@ -1457,6 +1541,10 @@ class Transpiler {
|
|||||||
|
|
||||||
this.transpilePythonAsyncToSync ()
|
this.transpilePythonAsyncToSync ()
|
||||||
|
|
||||||
|
this.transpilePhpAsyncToSync ()
|
||||||
|
|
||||||
|
this.transpilePhpBaseClassMethods ()
|
||||||
|
|
||||||
log.bright.green ('Transpiled successfully.')
|
log.bright.green ('Transpiled successfully.')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1469,12 +1557,14 @@ if (require.main === module) { // called directly like `node module`
|
|||||||
const transpiler = new Transpiler ()
|
const transpiler = new Transpiler ()
|
||||||
const test = process.argv.includes ('--test') || process.argv.includes ('--tests')
|
const test = process.argv.includes ('--test') || process.argv.includes ('--tests')
|
||||||
const errors = process.argv.includes ('--error') || process.argv.includes ('--errors')
|
const errors = process.argv.includes ('--error') || process.argv.includes ('--errors')
|
||||||
|
const force = process.argv.includes ('--force')
|
||||||
|
log.bright.green ({ force })
|
||||||
if (test) {
|
if (test) {
|
||||||
transpiler.transpileTests ()
|
transpiler.transpileTests ()
|
||||||
} else if (errors) {
|
} else if (errors) {
|
||||||
transpiler.transpileErrorHierarchy ()
|
transpiler.transpileErrorHierarchy ()
|
||||||
} else {
|
} else {
|
||||||
transpiler.transpileEverything ()
|
transpiler.transpileEverything (force)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { // if required as a module
|
} else { // if required as a module
|
||||||
|
|||||||
Generated
Vendored
+2
@@ -52,6 +52,8 @@ function vssEverything () {
|
|||||||
|
|
||||||
vss ('./ccxt.js', "const version = '{version}'", version)
|
vss ('./ccxt.js', "const version = '{version}'", version)
|
||||||
vss ('./php/base/Exchange.php', "$version = '{version}'", version)
|
vss ('./php/base/Exchange.php', "$version = '{version}'", version)
|
||||||
|
vss ('./php/async/base/Exchange.php', "VERSION = '{version}'", version)
|
||||||
|
vss ('./php/async/base/Exchange.php', "$version = '{version}'", version)
|
||||||
vss ('./php/base/Exchange.php', "VERSION = '{version}'", version)
|
vss ('./php/base/Exchange.php', "VERSION = '{version}'", version)
|
||||||
vss ('./python/ccxt/__init__.py', "__version__ = '{version}'", version)
|
vss ('./python/ccxt/__init__.py', "__version__ = '{version}'", version)
|
||||||
vss ('./python/ccxt/base/exchange.py', "__version__ = '{version}'", version)
|
vss ('./python/ccxt/base/exchange.py', "__version__ = '{version}'", version)
|
||||||
|
|||||||
Generated
Vendored
+18
-10
@@ -56,16 +56,21 @@ declare module 'ccxt' {
|
|||||||
symbol: string;
|
symbol: string;
|
||||||
base: string;
|
base: string;
|
||||||
quote: string;
|
quote: string;
|
||||||
baseId: string,
|
baseId: string;
|
||||||
quoteId: string,
|
quoteId: string;
|
||||||
|
type?: string;
|
||||||
|
spot?: boolean;
|
||||||
|
margin?: boolean;
|
||||||
|
swap?: boolean;
|
||||||
|
future?: boolean;
|
||||||
active: boolean;
|
active: boolean;
|
||||||
precision: { base: number, quote: number, amount: number, price: number };
|
precision: { base: number, quote: number, amount: number, price: number };
|
||||||
limits: { amount: MinMax, price: MinMax, cost?: MinMax };
|
limits: { amount: MinMax, price: MinMax, cost?: MinMax };
|
||||||
tierBased: boolean,
|
tierBased: boolean;
|
||||||
percentage: boolean,
|
percentage: boolean;
|
||||||
taker: number,
|
taker: number;
|
||||||
maker: number,
|
maker: number;
|
||||||
info: any,
|
info: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Order {
|
export interface Order {
|
||||||
@@ -417,9 +422,9 @@ declare module 'ccxt' {
|
|||||||
|
|
||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
|
|
||||||
|
export class aax extends Exchange {}
|
||||||
export class acx extends Exchange {}
|
export class acx extends Exchange {}
|
||||||
export class aofex extends Exchange {}
|
export class aofex extends Exchange {}
|
||||||
export class bcex extends Exchange {}
|
|
||||||
export class bequant extends hitbtc {}
|
export class bequant extends hitbtc {}
|
||||||
export class bibox extends Exchange {}
|
export class bibox extends Exchange {}
|
||||||
export class bigone extends Exchange {}
|
export class bigone extends Exchange {}
|
||||||
@@ -458,6 +463,7 @@ declare module 'ccxt' {
|
|||||||
export class bw extends Exchange {}
|
export class bw extends Exchange {}
|
||||||
export class bybit extends Exchange {}
|
export class bybit extends Exchange {}
|
||||||
export class bytetrade extends Exchange {}
|
export class bytetrade extends Exchange {}
|
||||||
|
export class cdax extends huobipro {}
|
||||||
export class cex extends Exchange {}
|
export class cex extends Exchange {}
|
||||||
export class chilebit extends foxbit {}
|
export class chilebit extends foxbit {}
|
||||||
export class coinbase extends Exchange {}
|
export class coinbase extends Exchange {}
|
||||||
@@ -475,9 +481,11 @@ declare module 'ccxt' {
|
|||||||
export class coinspot extends Exchange {}
|
export class coinspot extends Exchange {}
|
||||||
export class crex24 extends Exchange {}
|
export class crex24 extends Exchange {}
|
||||||
export class currencycom extends Exchange {}
|
export class currencycom extends Exchange {}
|
||||||
|
export class delta extends Exchange {}
|
||||||
export class deribit extends Exchange {}
|
export class deribit extends Exchange {}
|
||||||
export class digifinex extends Exchange {}
|
export class digifinex extends Exchange {}
|
||||||
export class dsx extends Exchange {}
|
export class dsx extends Exchange {}
|
||||||
|
export class equos extends Exchange {}
|
||||||
export class eterbase extends Exchange {}
|
export class eterbase extends Exchange {}
|
||||||
export class exmo extends Exchange {}
|
export class exmo extends Exchange {}
|
||||||
export class exx extends Exchange {}
|
export class exx extends Exchange {}
|
||||||
@@ -488,12 +496,12 @@ declare module 'ccxt' {
|
|||||||
export class ftx extends Exchange {}
|
export class ftx extends Exchange {}
|
||||||
export class gateio extends Exchange {}
|
export class gateio extends Exchange {}
|
||||||
export class gemini extends Exchange {}
|
export class gemini extends Exchange {}
|
||||||
|
export class gopax extends Exchange {}
|
||||||
export class hbtc extends Exchange {}
|
export class hbtc extends Exchange {}
|
||||||
export class hitbtc extends Exchange {}
|
export class hitbtc extends Exchange {}
|
||||||
export class hollaex extends Exchange {}
|
export class hollaex extends Exchange {}
|
||||||
export class huobijp extends huobipro {}
|
export class huobijp extends huobipro {}
|
||||||
export class huobipro extends Exchange {}
|
export class huobipro extends Exchange {}
|
||||||
export class huobiru extends huobipro {}
|
|
||||||
export class ice3x extends Exchange {}
|
export class ice3x extends Exchange {}
|
||||||
export class idex extends Exchange {}
|
export class idex extends Exchange {}
|
||||||
export class independentreserve extends Exchange {}
|
export class independentreserve extends Exchange {}
|
||||||
@@ -506,11 +514,11 @@ declare module 'ccxt' {
|
|||||||
export class latoken extends Exchange {}
|
export class latoken extends Exchange {}
|
||||||
export class lbank extends Exchange {}
|
export class lbank extends Exchange {}
|
||||||
export class liquid extends Exchange {}
|
export class liquid extends Exchange {}
|
||||||
export class livecoin extends Exchange {}
|
|
||||||
export class luno extends Exchange {}
|
export class luno extends Exchange {}
|
||||||
export class lykke extends Exchange {}
|
export class lykke extends Exchange {}
|
||||||
export class mercado extends Exchange {}
|
export class mercado extends Exchange {}
|
||||||
export class mixcoins extends Exchange {}
|
export class mixcoins extends Exchange {}
|
||||||
|
export class ndax extends Exchange {}
|
||||||
export class novadax extends Exchange {}
|
export class novadax extends Exchange {}
|
||||||
export class oceanex extends Exchange {}
|
export class oceanex extends Exchange {}
|
||||||
export class okcoin extends okex {}
|
export class okcoin extends okex {}
|
||||||
|
|||||||
Generated
Vendored
+7
-4
@@ -35,16 +35,16 @@ const Exchange = require ('./js/base/Exchange')
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// this is updated by vss.js when building
|
// this is updated by vss.js when building
|
||||||
|
|
||||||
const version = '1.38.76'
|
const version = '1.42.67'
|
||||||
|
|
||||||
Exchange.ccxtVersion = version
|
Exchange.ccxtVersion = version
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
const exchanges = {
|
const exchanges = {
|
||||||
|
'aax': require ('./js/aax.js'),
|
||||||
'acx': require ('./js/acx.js'),
|
'acx': require ('./js/acx.js'),
|
||||||
'aofex': require ('./js/aofex.js'),
|
'aofex': require ('./js/aofex.js'),
|
||||||
'bcex': require ('./js/bcex.js'),
|
|
||||||
'bequant': require ('./js/bequant.js'),
|
'bequant': require ('./js/bequant.js'),
|
||||||
'bibox': require ('./js/bibox.js'),
|
'bibox': require ('./js/bibox.js'),
|
||||||
'bigone': require ('./js/bigone.js'),
|
'bigone': require ('./js/bigone.js'),
|
||||||
@@ -83,6 +83,7 @@ const exchanges = {
|
|||||||
'bw': require ('./js/bw.js'),
|
'bw': require ('./js/bw.js'),
|
||||||
'bybit': require ('./js/bybit.js'),
|
'bybit': require ('./js/bybit.js'),
|
||||||
'bytetrade': require ('./js/bytetrade.js'),
|
'bytetrade': require ('./js/bytetrade.js'),
|
||||||
|
'cdax': require ('./js/cdax.js'),
|
||||||
'cex': require ('./js/cex.js'),
|
'cex': require ('./js/cex.js'),
|
||||||
'chilebit': require ('./js/chilebit.js'),
|
'chilebit': require ('./js/chilebit.js'),
|
||||||
'coinbase': require ('./js/coinbase.js'),
|
'coinbase': require ('./js/coinbase.js'),
|
||||||
@@ -100,9 +101,11 @@ const exchanges = {
|
|||||||
'coinspot': require ('./js/coinspot.js'),
|
'coinspot': require ('./js/coinspot.js'),
|
||||||
'crex24': require ('./js/crex24.js'),
|
'crex24': require ('./js/crex24.js'),
|
||||||
'currencycom': require ('./js/currencycom.js'),
|
'currencycom': require ('./js/currencycom.js'),
|
||||||
|
'delta': require ('./js/delta.js'),
|
||||||
'deribit': require ('./js/deribit.js'),
|
'deribit': require ('./js/deribit.js'),
|
||||||
'digifinex': require ('./js/digifinex.js'),
|
'digifinex': require ('./js/digifinex.js'),
|
||||||
'dsx': require ('./js/dsx.js'),
|
'dsx': require ('./js/dsx.js'),
|
||||||
|
'equos': require ('./js/equos.js'),
|
||||||
'eterbase': require ('./js/eterbase.js'),
|
'eterbase': require ('./js/eterbase.js'),
|
||||||
'exmo': require ('./js/exmo.js'),
|
'exmo': require ('./js/exmo.js'),
|
||||||
'exx': require ('./js/exx.js'),
|
'exx': require ('./js/exx.js'),
|
||||||
@@ -113,12 +116,12 @@ const exchanges = {
|
|||||||
'ftx': require ('./js/ftx.js'),
|
'ftx': require ('./js/ftx.js'),
|
||||||
'gateio': require ('./js/gateio.js'),
|
'gateio': require ('./js/gateio.js'),
|
||||||
'gemini': require ('./js/gemini.js'),
|
'gemini': require ('./js/gemini.js'),
|
||||||
|
'gopax': require ('./js/gopax.js'),
|
||||||
'hbtc': require ('./js/hbtc.js'),
|
'hbtc': require ('./js/hbtc.js'),
|
||||||
'hitbtc': require ('./js/hitbtc.js'),
|
'hitbtc': require ('./js/hitbtc.js'),
|
||||||
'hollaex': require ('./js/hollaex.js'),
|
'hollaex': require ('./js/hollaex.js'),
|
||||||
'huobijp': require ('./js/huobijp.js'),
|
'huobijp': require ('./js/huobijp.js'),
|
||||||
'huobipro': require ('./js/huobipro.js'),
|
'huobipro': require ('./js/huobipro.js'),
|
||||||
'huobiru': require ('./js/huobiru.js'),
|
|
||||||
'ice3x': require ('./js/ice3x.js'),
|
'ice3x': require ('./js/ice3x.js'),
|
||||||
'idex': require ('./js/idex.js'),
|
'idex': require ('./js/idex.js'),
|
||||||
'independentreserve': require ('./js/independentreserve.js'),
|
'independentreserve': require ('./js/independentreserve.js'),
|
||||||
@@ -131,11 +134,11 @@ const exchanges = {
|
|||||||
'latoken': require ('./js/latoken.js'),
|
'latoken': require ('./js/latoken.js'),
|
||||||
'lbank': require ('./js/lbank.js'),
|
'lbank': require ('./js/lbank.js'),
|
||||||
'liquid': require ('./js/liquid.js'),
|
'liquid': require ('./js/liquid.js'),
|
||||||
'livecoin': require ('./js/livecoin.js'),
|
|
||||||
'luno': require ('./js/luno.js'),
|
'luno': require ('./js/luno.js'),
|
||||||
'lykke': require ('./js/lykke.js'),
|
'lykke': require ('./js/lykke.js'),
|
||||||
'mercado': require ('./js/mercado.js'),
|
'mercado': require ('./js/mercado.js'),
|
||||||
'mixcoins': require ('./js/mixcoins.js'),
|
'mixcoins': require ('./js/mixcoins.js'),
|
||||||
|
'ndax': require ('./js/ndax.js'),
|
||||||
'novadax': require ('./js/novadax.js'),
|
'novadax': require ('./js/novadax.js'),
|
||||||
'oceanex': require ('./js/oceanex.js'),
|
'oceanex': require ('./js/oceanex.js'),
|
||||||
'okcoin': require ('./js/okcoin.js'),
|
'okcoin': require ('./js/okcoin.js'),
|
||||||
|
|||||||
Generated
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
git checkout HEAD package.json README.md ccxt.d.ts ccxt.js wiki python php dist doc
|
||||||
Generated
Vendored
+11519
-2996
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+1784
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+1
@@ -346,6 +346,7 @@ module.exports = class acx extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': this.safeFloat (order, 'price'),
|
'price': this.safeFloat (order, 'price'),
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+4
@@ -132,6 +132,9 @@ module.exports = class aofex extends Exchange {
|
|||||||
'show_all': '0', // '1' to show zero balances
|
'show_all': '0', // '1' to show zero balances
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'commonCurrencies': {
|
||||||
|
'CPC': 'Consensus Planet Coin',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -798,6 +801,7 @@ module.exports = class aofex extends Exchange {
|
|||||||
'symbol': market['symbol'],
|
'symbol': market['symbol'],
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+43
-47
@@ -411,20 +411,20 @@ module.exports = class Exchange {
|
|||||||
if (!!enabled) { // eslint-disable-line no-extra-boolean-cast
|
if (!!enabled) { // eslint-disable-line no-extra-boolean-cast
|
||||||
if ('test' in this.urls) {
|
if ('test' in this.urls) {
|
||||||
if (typeof this.urls['api'] === 'string') {
|
if (typeof this.urls['api'] === 'string') {
|
||||||
this.urls['api_backup'] = this.urls['api']
|
this.urls['apiBackup'] = this.urls['api']
|
||||||
this.urls['api'] = this.urls['test']
|
this.urls['api'] = this.urls['test']
|
||||||
} else {
|
} else {
|
||||||
this.urls['api_backup'] = clone (this.urls['api'])
|
this.urls['apiBackup'] = clone (this.urls['api'])
|
||||||
this.urls['api'] = clone (this.urls['test'])
|
this.urls['api'] = clone (this.urls['test'])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new NotSupported (this.id + ' does not have a sandbox URL')
|
throw new NotSupported (this.id + ' does not have a sandbox URL')
|
||||||
}
|
}
|
||||||
} else if ('api_backup' in this.urls) {
|
} else if ('apiBackup' in this.urls) {
|
||||||
if (typeof this.urls['api'] === 'string') {
|
if (typeof this.urls['api'] === 'string') {
|
||||||
this.urls['api'] = this.urls['api_backup']
|
this.urls['api'] = this.urls['apiBackup']
|
||||||
} else {
|
} else {
|
||||||
this.urls['api'] = clone (this.urls['api_backup'])
|
this.urls['api'] = clone (this.urls['apiBackup'])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -576,34 +576,31 @@ module.exports = class Exchange {
|
|||||||
handleRestResponse (response, url, method = 'GET', requestHeaders = undefined, requestBody = undefined) {
|
handleRestResponse (response, url, method = 'GET', requestHeaders = undefined, requestBody = undefined) {
|
||||||
|
|
||||||
return response.text ().then ((responseBody) => {
|
return response.text ().then ((responseBody) => {
|
||||||
|
|
||||||
const json = this.parseJson (responseBody)
|
|
||||||
|
|
||||||
const responseHeaders = this.getResponseHeaders (response)
|
const responseHeaders = this.getResponseHeaders (response)
|
||||||
|
const bodyText = this.onRestResponse (response.status, response.statusText, url, method, responseHeaders, responseBody, requestHeaders, requestBody);
|
||||||
|
const json = this.parseJson (bodyText)
|
||||||
if (this.enableLastResponseHeaders) {
|
if (this.enableLastResponseHeaders) {
|
||||||
this.last_response_headers = responseHeaders
|
this.last_response_headers = responseHeaders
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.enableLastHttpResponse) {
|
if (this.enableLastHttpResponse) {
|
||||||
this.last_http_response = responseBody
|
this.last_http_response = responseBody
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.enableLastJsonResponse) {
|
if (this.enableLastJsonResponse) {
|
||||||
this.last_json_response = json
|
this.last_json_response = json
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.verbose) {
|
if (this.verbose) {
|
||||||
this.print ("handleRestResponse:\n", this.id, method, url, response.status, response.statusText, "\nResponse:\n", responseHeaders, "\n", responseBody, "\n")
|
this.print ("handleRestResponse:\n", this.id, method, url, response.status, response.statusText, "\nResponse:\n", responseHeaders, "\n", responseBody, "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
this.handleErrors (response.status, response.statusText, url, method, responseHeaders, responseBody, json, requestHeaders, requestBody)
|
this.handleErrors (response.status, response.statusText, url, method, responseHeaders, responseBody, json, requestHeaders, requestBody)
|
||||||
this.handleHttpStatusCode (response.status, response.statusText, url, method, responseBody)
|
this.handleHttpStatusCode (response.status, response.statusText, url, method, responseBody)
|
||||||
|
|
||||||
return json || responseBody
|
return json || responseBody
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onRestResponse (statusCode, statusText, url, method, responseHeaders, responseBody, requestHeaders, requestBody) {
|
||||||
|
return responseBody.trim ().replace (/:(\d{15,}),/g, ':"$1",');
|
||||||
|
}
|
||||||
|
|
||||||
setMarkets (markets, currencies = undefined) {
|
setMarkets (markets, currencies = undefined) {
|
||||||
const values = Object.values (markets).map ((market) => deepExtend ({
|
const values = Object.values (markets).map ((market) => deepExtend ({
|
||||||
'limits': this.limits,
|
'limits': this.limits,
|
||||||
@@ -903,6 +900,10 @@ module.exports = class Exchange {
|
|||||||
return symbols.map ((symbol) => this.marketId (symbol))
|
return symbols.map ((symbol) => this.marketId (symbol))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currencyIds (codes) {
|
||||||
|
return codes.map ((code) => this.currencyId (code))
|
||||||
|
}
|
||||||
|
|
||||||
symbol (symbol) {
|
symbol (symbol) {
|
||||||
return this.market (symbol).symbol || symbol
|
return this.market (symbol).symbol || symbol
|
||||||
}
|
}
|
||||||
@@ -1036,7 +1037,7 @@ module.exports = class Exchange {
|
|||||||
array = array.filter ((entry) => entry[key] >= since)
|
array = array.filter ((entry) => entry[key] >= since)
|
||||||
}
|
}
|
||||||
if (limit !== undefined && limit !== null) {
|
if (limit !== undefined && limit !== null) {
|
||||||
array = (tail && !sinceIsDefined) ? array.slice (-limit) : array.slice (0, limit)
|
array = tail ? array.slice (-limit) : array.slice (0, limit)
|
||||||
}
|
}
|
||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
@@ -1054,18 +1055,18 @@ module.exports = class Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (limit !== undefined && limit !== null) {
|
if (limit !== undefined && limit !== null) {
|
||||||
array = (tail && !sinceIsDefined) ? array.slice (-limit) : array.slice (0, limit)
|
array = tail ? array.slice (-limit) : array.slice (0, limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
|
|
||||||
filterBySymbolSinceLimit (array, symbol = undefined, since = undefined, limit = undefined) {
|
filterBySymbolSinceLimit (array, symbol = undefined, since = undefined, limit = undefined, tail = false) {
|
||||||
return this.filterByValueSinceLimit (array, 'symbol', symbol, since, limit)
|
return this.filterByValueSinceLimit (array, 'symbol', symbol, since, limit, 'timestamp', tail)
|
||||||
}
|
}
|
||||||
|
|
||||||
filterByCurrencySinceLimit (array, code = undefined, since = undefined, limit = undefined) {
|
filterByCurrencySinceLimit (array, code = undefined, since = undefined, limit = undefined, tail = false) {
|
||||||
return this.filterByValueSinceLimit (array, 'currency', code, since, limit)
|
return this.filterByValueSinceLimit (array, 'currency', code, since, limit, 'timestamp', tail)
|
||||||
}
|
}
|
||||||
|
|
||||||
filterByArray (objects, key, values = undefined, indexed = true) {
|
filterByArray (objects, key, values = undefined, indexed = true) {
|
||||||
@@ -1095,7 +1096,8 @@ module.exports = class Exchange {
|
|||||||
let result = Object.values (trades || []).map ((trade) => this.extend (this.parseTrade (trade, market), params))
|
let result = Object.values (trades || []).map ((trade) => this.extend (this.parseTrade (trade, market), params))
|
||||||
result = sortBy (result, 'timestamp')
|
result = sortBy (result, 'timestamp')
|
||||||
const symbol = (market !== undefined) ? market['symbol'] : undefined
|
const symbol = (market !== undefined) ? market['symbol'] : undefined
|
||||||
return this.filterBySymbolSinceLimit (result, symbol, since, limit)
|
const tail = since === undefined
|
||||||
|
return this.filterBySymbolSinceLimit (result, symbol, since, limit, tail)
|
||||||
}
|
}
|
||||||
|
|
||||||
parseTransactions (transactions, currency = undefined, since = undefined, limit = undefined, params = {}) {
|
parseTransactions (transactions, currency = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
@@ -1106,7 +1108,8 @@ module.exports = class Exchange {
|
|||||||
let result = Object.values (transactions || []).map ((transaction) => this.extend (this.parseTransaction (transaction, currency), params))
|
let result = Object.values (transactions || []).map ((transaction) => this.extend (this.parseTransaction (transaction, currency), params))
|
||||||
result = this.sortBy (result, 'timestamp');
|
result = this.sortBy (result, 'timestamp');
|
||||||
const code = (currency !== undefined) ? currency['code'] : undefined;
|
const code = (currency !== undefined) ? currency['code'] : undefined;
|
||||||
return this.filterByCurrencySinceLimit (result, code, since, limit);
|
const tail = since === undefined;
|
||||||
|
return this.filterByCurrencySinceLimit (result, code, since, limit, tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
parseLedger (data, currency = undefined, since = undefined, limit = undefined, params = {}) {
|
parseLedger (data, currency = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
@@ -1124,7 +1127,8 @@ module.exports = class Exchange {
|
|||||||
}
|
}
|
||||||
result = this.sortBy (result, 'timestamp');
|
result = this.sortBy (result, 'timestamp');
|
||||||
const code = (currency !== undefined) ? currency['code'] : undefined;
|
const code = (currency !== undefined) ? currency['code'] : undefined;
|
||||||
return this.filterByCurrencySinceLimit (result, code, since, limit);
|
const tail = since === undefined;
|
||||||
|
return this.filterByCurrencySinceLimit (result, code, since, limit, tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
parseOrders (orders, market = undefined, since = undefined, limit = undefined, params = {}) {
|
parseOrders (orders, market = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
@@ -1154,7 +1158,8 @@ module.exports = class Exchange {
|
|||||||
Object.entries (orders).map (([ id, order ]) => this.extend (this.parseOrder (this.extend ({ 'id': id }, order), market), params))
|
Object.entries (orders).map (([ id, order ]) => this.extend (this.parseOrder (this.extend ({ 'id': id }, order), market), params))
|
||||||
result = sortBy (result, 'timestamp')
|
result = sortBy (result, 'timestamp')
|
||||||
const symbol = (market !== undefined) ? market['symbol'] : undefined
|
const symbol = (market !== undefined) ? market['symbol'] : undefined
|
||||||
return this.filterBySymbolSinceLimit (result, symbol, since, limit)
|
const tail = since === undefined
|
||||||
|
return this.filterBySymbolSinceLimit (result, symbol, since, limit, tail)
|
||||||
}
|
}
|
||||||
|
|
||||||
safeCurrency (currencyId, currency = undefined) {
|
safeCurrency (currencyId, currency = undefined) {
|
||||||
@@ -1225,19 +1230,10 @@ module.exports = class Exchange {
|
|||||||
// if (!this.isArray (ohlcvs)) {
|
// if (!this.isArray (ohlcvs)) {
|
||||||
// throw new ExchangeError (this.id + ' parseOHLCVs expected an array in the ohlcvs argument, but got ' + typeof ohlcvs);
|
// throw new ExchangeError (this.id + ' parseOHLCVs expected an array in the ohlcvs argument, but got ' + typeof ohlcvs);
|
||||||
// }
|
// }
|
||||||
ohlcvs = Object.values (ohlcvs || [])
|
const parsed = ohlcvs.map ((ohlcv) => this.parseOHLCV (ohlcv, market))
|
||||||
const result = []
|
const sorted = this.sortBy (parsed, 0)
|
||||||
for (let i = 0; i < ohlcvs.length; i++) {
|
const tail = since === undefined
|
||||||
if (limit && (result.length >= limit)) {
|
return this.filterBySinceLimit (sorted, since, limit, 0, tail)
|
||||||
break;
|
|
||||||
}
|
|
||||||
const ohlcv = this.parseOHLCV (ohlcvs[i], market)
|
|
||||||
if (since && (ohlcv[0] < since)) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
result.push (ohlcv)
|
|
||||||
}
|
|
||||||
return this.sortBy (result, 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
editLimitBuyOrder (id, symbol, ...args) {
|
editLimitBuyOrder (id, symbol, ...args) {
|
||||||
@@ -1260,20 +1256,20 @@ module.exports = class Exchange {
|
|||||||
return this.createOrder (symbol, ...args)
|
return this.createOrder (symbol, ...args)
|
||||||
}
|
}
|
||||||
|
|
||||||
createLimitOrder (symbol, ...args) {
|
createLimitOrder (symbol, side, amount, price = undefined, params = {}) {
|
||||||
return this.createOrder (symbol, 'limit', ...args)
|
return this.createOrder (symbol, 'limit', side, amount, price, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
createMarketOrder (symbol, ...args) {
|
createMarketOrder (symbol, side, amount, price = undefined, params = {}) {
|
||||||
return this.createOrder (symbol, 'market', ...args)
|
return this.createOrder (symbol, 'market', side, amount, price, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
createLimitBuyOrder (symbol, ...args) {
|
createLimitBuyOrder (symbol, amount, price = undefined, params = {}) {
|
||||||
return this.createOrder (symbol, 'limit', 'buy', ...args)
|
return this.createOrder (symbol, 'limit', 'buy', amount, price, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
createLimitSellOrder (symbol, ...args) {
|
createLimitSellOrder (symbol, amount, price = undefined, params = {}) {
|
||||||
return this.createOrder (symbol, 'limit', 'sell', ...args)
|
return this.createOrder (symbol, 'limit', 'sell', amount, price, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
createMarketBuyOrder (symbol, amount, params = {}) {
|
createMarketBuyOrder (symbol, amount, params = {}) {
|
||||||
@@ -1285,7 +1281,7 @@ module.exports = class Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
costToPrecision (symbol, cost) {
|
costToPrecision (symbol, cost) {
|
||||||
return decimalToPrecision (cost, ROUND, this.markets[symbol].precision.price, this.precisionMode, this.paddingMode)
|
return decimalToPrecision (cost, TRUNCATE, this.markets[symbol].precision.price, this.precisionMode, this.paddingMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
priceToPrecision (symbol, price) {
|
priceToPrecision (symbol, price) {
|
||||||
@@ -1372,7 +1368,7 @@ module.exports = class Exchange {
|
|||||||
// still takes the input as a hex string
|
// still takes the input as a hex string
|
||||||
// same as above but returns a string instead of an object
|
// same as above but returns a string instead of an object
|
||||||
const signature = this.signMessage (message, privateKey)
|
const signature = this.signMessage (message, privateKey)
|
||||||
return signature['r'] + this.remove0xPrefix (signature['s']) + this.binaryToBase16 (this.numberToBE (signature['v']));
|
return signature['r'] + this.remove0xPrefix (signature['s']) + this.binaryToBase16 (this.numberToBE (signature['v']))
|
||||||
}
|
}
|
||||||
|
|
||||||
oath () {
|
oath () {
|
||||||
|
|||||||
Generated
Vendored
+4
@@ -30,6 +30,10 @@ function subclass (BaseClass, classes, namespace = {}) {
|
|||||||
this.__proto__ = Class.prototype
|
this.__proto__ = Class.prototype
|
||||||
this.name = className
|
this.name = className
|
||||||
this.message = message
|
this.message = message
|
||||||
|
|
||||||
|
// https://github.com/Microsoft/TypeScript/wiki/FAQ#why-doesnt-extending-built-ins-like-error-array-and-map-work
|
||||||
|
|
||||||
|
Object.setPrototypeOf (this, Class.prototype)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Generated
Vendored
+10
-13
@@ -1,21 +1,18 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
const uuid = a => a ? (a ^ Math.random () * 16 >> a / 4).toString (16)
|
const uuid = a => a ? (a ^ Math.random () * 16 >> a / 4).toString (16) : ([1e7]+-1e3+-4e3+-8e3+-1e11).replace (/[018]/g, uuid)
|
||||||
: ([1e7]+-1e3+-4e3+-8e3+-1e11).replace (/[018]/g, uuid)
|
const uuid22 = a => a ? (a ^ Math.random () * 16 >> a / 4).toString (16) : ([1e7]+1e3+4e3+8e5).replace (/[018]/g, uuid22)
|
||||||
|
|
||||||
module.exports =
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
{ uuid
|
module.exports = {
|
||||||
|
|
||||||
// hasFetchOHLCV → has_fetch_ohlcv; parseHTTPResponse → parse_http_response
|
uuid
|
||||||
|
, uuid22
|
||||||
|
// hasFetchOHLCV → has_fetch_ohlcv; parseHTTPResponse → parse_http_response
|
||||||
, unCamelCase: s => s.match (/^[A-Z0-9_]+$/) ? s : (s.replace (/[a-z0-9][A-Z]/g, x => x[0] + '_' + x[1]).replace(/[A-Z0-9][A-Z0-9][a-z]/g, x => x[0] + '_' + x[1] + x[2]).toLowerCase ())
|
, unCamelCase: s => s.match (/^[A-Z0-9_]+$/) ? s : (s.replace (/[a-z0-9][A-Z]/g, x => x[0] + '_' + x[1]).replace(/[A-Z0-9][A-Z0-9][a-z]/g, x => x[0] + '_' + x[1] + x[2]).toLowerCase ())
|
||||||
|
, capitalize: s => s.length ? (s.charAt (0).toUpperCase () + s.slice (1)) : s
|
||||||
, capitalize: s => s.length
|
|
||||||
? (s.charAt (0).toUpperCase () + s.slice (1))
|
|
||||||
: s
|
|
||||||
, strip: s => s.replace(/^\s+|\s+$/g, '')
|
, strip: s => s.replace(/^\s+|\s+$/g, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
Generated
Vendored
-687
@@ -1,687 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
const Exchange = require ('./base/Exchange');
|
|
||||||
const { ExchangeError, ArgumentsRequired, AuthenticationError, InsufficientFunds, InvalidOrder, OrderNotFound } = require ('./base/errors');
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
module.exports = class bcex extends Exchange {
|
|
||||||
describe () {
|
|
||||||
return this.deepExtend (super.describe (), {
|
|
||||||
'id': 'bcex',
|
|
||||||
'name': 'BCEX',
|
|
||||||
'countries': [ 'CN', 'HK' ],
|
|
||||||
'version': '1',
|
|
||||||
'has': {
|
|
||||||
'cancelOrder': true,
|
|
||||||
'createOrder': true,
|
|
||||||
'fetchBalance': true,
|
|
||||||
'fetchClosedOrders': 'emulated',
|
|
||||||
'fetchMarkets': true,
|
|
||||||
'fetchMyTrades': true,
|
|
||||||
'fetchOpenOrders': true,
|
|
||||||
'fetchOrder': true,
|
|
||||||
'fetchOrders': true,
|
|
||||||
'fetchOrderBook': true,
|
|
||||||
'fetchTicker': true,
|
|
||||||
'fetchTickers': false,
|
|
||||||
'fetchTrades': true,
|
|
||||||
'fetchTradingLimits': true,
|
|
||||||
},
|
|
||||||
'urls': {
|
|
||||||
'logo': 'https://user-images.githubusercontent.com/51840849/77231516-851c6900-6bac-11ea-8fd6-ee5c23eddbd4.jpg',
|
|
||||||
'api': 'https://www.bcex.top',
|
|
||||||
'www': 'https://www.bcex.top',
|
|
||||||
'doc': 'https://github.com/BCEX-TECHNOLOGY-LIMITED/API_Docs/wiki/Interface',
|
|
||||||
'fees': 'https://bcex.udesk.cn/hc/articles/57085',
|
|
||||||
'referral': 'https://www.bcex.top/register?invite_code=758978&lang=en',
|
|
||||||
},
|
|
||||||
'status': {
|
|
||||||
'status': 'error',
|
|
||||||
'updated': undefined,
|
|
||||||
'eta': undefined,
|
|
||||||
'url': undefined,
|
|
||||||
},
|
|
||||||
'api': {
|
|
||||||
'public': {
|
|
||||||
'get': [
|
|
||||||
'Api_Market/getPriceList', // tickers
|
|
||||||
'Api_Order/ticker', // last ohlcv candle (ticker)
|
|
||||||
'Api_Order/depth', // orderbook
|
|
||||||
'Api_Market/getCoinTrade', // ticker
|
|
||||||
'Api_Order/marketOrder', // trades...
|
|
||||||
],
|
|
||||||
'post': [
|
|
||||||
'Api_Market/getPriceList', // tickers
|
|
||||||
'Api_Order/ticker', // last ohlcv candle (ticker)
|
|
||||||
'Api_Order/depth', // orderbook
|
|
||||||
'Api_Market/getCoinTrade', // ticker
|
|
||||||
'Api_Order/marketOrder', // trades...
|
|
||||||
],
|
|
||||||
},
|
|
||||||
'private': {
|
|
||||||
'post': [
|
|
||||||
'Api_Order/cancel',
|
|
||||||
'Api_Order/coinTrust', // limit order
|
|
||||||
'Api_Order/orderList', // open / all orders (my trades?)
|
|
||||||
'Api_Order/orderInfo',
|
|
||||||
'Api_Order/tradeList', // open / all orders
|
|
||||||
'Api_Order/trustList', // ?
|
|
||||||
'Api_User/userBalance',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'fees': {
|
|
||||||
'trading': {
|
|
||||||
'tierBased': false,
|
|
||||||
'percentage': true,
|
|
||||||
'maker': 0.1 / 100,
|
|
||||||
'taker': 0.2 / 100,
|
|
||||||
},
|
|
||||||
'funding': {
|
|
||||||
'tierBased': false,
|
|
||||||
'percentage': false,
|
|
||||||
'withdraw': {
|
|
||||||
'ckusd': 0.0,
|
|
||||||
'other': 0.05 / 100,
|
|
||||||
},
|
|
||||||
'deposit': {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'exceptions': {
|
|
||||||
'该币不存在,非法操作': ExchangeError, // { code: 1, msg: "该币不存在,非法操作" } - returned when a required symbol parameter is missing in the request (also, maybe on other types of errors as well)
|
|
||||||
'公钥不合法': AuthenticationError, // { code: 1, msg: '公钥不合法' } - wrong public key
|
|
||||||
'您的可用余额不足': InsufficientFunds, // { code: 1, msg: '您的可用余额不足' } - your available balance is insufficient
|
|
||||||
'您的btc不足': InsufficientFunds, // { code: 1, msg: '您的btc不足' } - your btc is insufficient
|
|
||||||
'参数非法': InvalidOrder, // {'code': 1, 'msg': '参数非法'} - 'Parameter illegal'
|
|
||||||
'订单信息不存在': OrderNotFound, // {'code': 1, 'msg': '订单信息不存在'} - 'Order information does not exist'
|
|
||||||
},
|
|
||||||
'commonCurrencies': {
|
|
||||||
'UNI': 'UNI COIN',
|
|
||||||
'PNT': 'Penta',
|
|
||||||
},
|
|
||||||
'options': {
|
|
||||||
'limits': {
|
|
||||||
// hardcoding is deprecated, using these predefined values is not recommended, use loadTradingLimits instead
|
|
||||||
'AFC/CKUSD': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 6, 'max': 120000 }}},
|
|
||||||
'AFC/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 6, 'max': 120000 }}},
|
|
||||||
'AFT/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 15, 'max': 300000 }}},
|
|
||||||
'AICC/CNET': { 'precision': { 'amount': 2, 'price': 2 }, 'limits': { 'amount': { 'min': 5, 'max': 50000 }}},
|
|
||||||
'AIDOC/CKUSD': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 5, 'max': 100000 }}},
|
|
||||||
'AISI/ETH': { 'precision': { 'amount': 4, 'price': 2 }, 'limits': { 'amount': { 'min': 0.001, 'max': 500 }}},
|
|
||||||
'AIT/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 20, 'max': 400000 }}},
|
|
||||||
'ANS/BTC': { 'precision': { 'amount': 4, 'price': 8 }, 'limits': { 'amount': { 'min': 0.1, 'max': 500 }}},
|
|
||||||
'ANS/CKUSD': { 'precision': { 'amount': 2, 'price': 2 }, 'limits': { 'amount': { 'min': 0.1, 'max': 1000 }}},
|
|
||||||
'ARC/CNET': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 60, 'max': 600000 }}},
|
|
||||||
'AXF/CNET': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 100, 'max': 1000000 }}},
|
|
||||||
'BASH/CKUSD': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 250, 'max': 3000000 }}},
|
|
||||||
'BATT/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 60, 'max': 1500000 }}},
|
|
||||||
'BCD/BTC': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 0.3, 'max': 7000 }}},
|
|
||||||
'BHPC/BTC': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 2, 'max': 70000 }}},
|
|
||||||
'BHPC/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 2, 'max': 60000 }}},
|
|
||||||
'BOPO/BTC': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 100, 'max': 2000000 }}},
|
|
||||||
'BOPO/CKUSD': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 100, 'max': 10000000 }}},
|
|
||||||
'BTC/CKUSD': { 'precision': { 'amount': 4, 'price': 2 }, 'limits': { 'amount': { 'min': 0.001, 'max': 10 }}},
|
|
||||||
'BTC/CNET': { 'precision': { 'amount': 4, 'price': 2 }, 'limits': { 'amount': { 'min': 0.0005, 'max': 5 }}},
|
|
||||||
'BTC/USDT': { 'precision': { 'amount': 4, 'price': 2 }, 'limits': { 'amount': { 'min': 0.0002, 'max': 4 }}},
|
|
||||||
'BTE/CNET': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 25, 'max': 250000 }}},
|
|
||||||
'BU/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 20, 'max': 400000 }}},
|
|
||||||
'CIC/CNET': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 3000, 'max': 30000000 }}},
|
|
||||||
'CIT/CKUSD': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 4, 'max': 40000 }}},
|
|
||||||
'CIT/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 4, 'max': 40000 }}},
|
|
||||||
'CMT/CKUSD': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 5, 'max': 2500000 }}},
|
|
||||||
'CNET/CKUSD': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 12, 'max': 120000 }}},
|
|
||||||
'CNMC/BTC': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 4, 'max': 50000 }}},
|
|
||||||
'CTC/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 5, 'max': 550000 }}},
|
|
||||||
'CZR/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 12, 'max': 500000 }}},
|
|
||||||
'DCON/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 8, 'max': 300000 }}},
|
|
||||||
'DCT/BTC': { 'precision': { 'amount': 4, 'price': 8 }, 'limits': { 'amount': { 'min': 2, 'max': 40000 }}},
|
|
||||||
'DCT/CKUSD': { 'precision': { 'amount': 2, 'price': 3 }, 'limits': { 'amount': { 'min': 2, 'max': 2000 }}},
|
|
||||||
'DOGE/BTC': { 'precision': { 'amount': 4, 'price': 8 }, 'limits': { 'amount': { 'min': 3000, 'max': 14000000 }}},
|
|
||||||
'DOGE/CKUSD': { 'precision': { 'amount': 2, 'price': 6 }, 'limits': { 'amount': { 'min': 500, 'max': 2000000 }}},
|
|
||||||
'DRCT/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 16, 'max': 190000 }}},
|
|
||||||
'ELA/BTC': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 0.02, 'max': 500 }}},
|
|
||||||
'ELF/BTC': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 0.1, 'max': 100000 }}},
|
|
||||||
'ELF/CKUSD': { 'precision': { 'amount': 2, 'price': 3 }, 'limits': { 'amount': { 'min': 0.01, 'max': 100000 }}},
|
|
||||||
'EOS/CKUSD': { 'precision': { 'amount': 2, 'price': 2 }, 'limits': { 'amount': { 'min': 0.5, 'max': 5000 }}},
|
|
||||||
'EOS/CNET': { 'precision': { 'amount': 2, 'price': 2 }, 'limits': { 'amount': { 'min': 2.5, 'max': 30000 }}},
|
|
||||||
'EOS/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 0.18, 'max': 1800 }}},
|
|
||||||
'ETC/BTC': { 'precision': { 'amount': 4, 'price': 8 }, 'limits': { 'amount': { 'min': 0.2, 'max': 2500 }}},
|
|
||||||
'ETC/CKUSD': { 'precision': { 'amount': 2, 'price': 2 }, 'limits': { 'amount': { 'min': 0.2, 'max': 2500 }}},
|
|
||||||
'ETF/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 7, 'max': 150000 }}},
|
|
||||||
'ETH/BTC': { 'precision': { 'amount': 4, 'price': 8 }, 'limits': { 'amount': { 'min': 0.015, 'max': 100 }}},
|
|
||||||
'ETH/CKUSD': { 'precision': { 'amount': 4, 'price': 4 }, 'limits': { 'amount': { 'min': 0.005, 'max': 100 }}},
|
|
||||||
'ETH/USDT': { 'precision': { 'amount': 4, 'price': 2 }, 'limits': { 'amount': { 'min': 0.005, 'max': 100 }}},
|
|
||||||
'FCT/BTC': { 'precision': { 'amount': 4, 'price': 8 }, 'limits': { 'amount': { 'min': 0.24, 'max': 1000 }}},
|
|
||||||
'FCT/CKUSD': { 'precision': { 'amount': 2, 'price': 2 }, 'limits': { 'amount': { 'min': 0.24, 'max': 1000 }}},
|
|
||||||
'GAME/CNET': { 'precision': { 'amount': 2, 'price': 2 }, 'limits': { 'amount': { 'min': 1, 'max': 10000 }}},
|
|
||||||
'GOOC/CKUSD': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 200, 'max': 2000000 }}},
|
|
||||||
'GP/CNET': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 600, 'max': 6000000 }}},
|
|
||||||
'HSC/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 1000, 'max': 20000000 }}},
|
|
||||||
'IFISH/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 300, 'max': 8000000 }}},
|
|
||||||
'IIC/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 50, 'max': 4000000 }}},
|
|
||||||
'IMOS/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 15, 'max': 300000 }}},
|
|
||||||
'JC/CNET': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 300, 'max': 3000000 }}},
|
|
||||||
'LBTC/BTC': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 0.1, 'max': 3000 }}},
|
|
||||||
'LEC/CNET': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 500, 'max': 5000000 }}},
|
|
||||||
'LKY/CKUSD': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 10, 'max': 70000 }}},
|
|
||||||
'LKY/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 10, 'max': 100000 }}},
|
|
||||||
'LMC/CNET': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 25, 'max': 250000 }}},
|
|
||||||
'LSK/CNET': { 'precision': { 'amount': 2, 'price': 2 }, 'limits': { 'amount': { 'min': 0.3, 'max': 3000 }}},
|
|
||||||
'LTC/BTC': { 'precision': { 'amount': 4, 'price': 8 }, 'limits': { 'amount': { 'min': 0.01, 'max': 500 }}},
|
|
||||||
'LTC/CKUSD': { 'precision': { 'amount': 2, 'price': 2 }, 'limits': { 'amount': { 'min': 0.01, 'max': 500 }}},
|
|
||||||
'LTC/USDT': { 'precision': { 'amount': 4, 'price': 2 }, 'limits': { 'amount': { 'min': 0.02, 'max': 450 }}},
|
|
||||||
'MC/CNET': { 'precision': { 'amount': 2, 'price': 6 }, 'limits': { 'amount': { 'min': 10000, 'max': 100000000 }}},
|
|
||||||
'MCC/CKUSD': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 30, 'max': 350000 }}},
|
|
||||||
'MOC/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 25, 'max': 600000 }}},
|
|
||||||
'MRYC/CNET': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 300, 'max': 3000000 }}},
|
|
||||||
'MT/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 200, 'max': 6000000 }}},
|
|
||||||
'MXI/CNET': { 'precision': { 'amount': 2, 'price': 6 }, 'limits': { 'amount': { 'min': 5000, 'max': 60000000 }}},
|
|
||||||
'NAI/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 10, 'max': 100000 }}},
|
|
||||||
'NAS/BTC': { 'precision': { 'amount': 4, 'price': 8 }, 'limits': { 'amount': { 'min': 0.2, 'max': 15000 }}},
|
|
||||||
'NAS/CKUSD': { 'precision': { 'amount': 2, 'price': 2 }, 'limits': { 'amount': { 'min': 0.5, 'max': 5000 }}},
|
|
||||||
'NEWOS/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 65, 'max': 700000 }}},
|
|
||||||
'NKN/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 3, 'max': 350000 }}},
|
|
||||||
'NTK/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 2, 'max': 30000 }}},
|
|
||||||
'ONT/CKUSD': { 'precision': { 'amount': 2, 'price': 3 }, 'limits': { 'amount': { 'min': 0.2, 'max': 2000 }}},
|
|
||||||
'ONT/ETH': { 'precision': { 'amount': 3, 'price': 8 }, 'limits': { 'amount': { 'min': 0.01, 'max': 1000 }}},
|
|
||||||
'PNT/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 80, 'max': 800000 }}},
|
|
||||||
'PST/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 5, 'max': 100000 }}},
|
|
||||||
'PTT/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 450, 'max': 10000000 }}},
|
|
||||||
'QTUM/BTC': { 'precision': { 'amount': 4, 'price': 8 }, 'limits': { 'amount': { 'min': 0.4, 'max': 2800 }}},
|
|
||||||
'QTUM/CKUSD': { 'precision': { 'amount': 2, 'price': 2 }, 'limits': { 'amount': { 'min': 0.1, 'max': 1000 }}},
|
|
||||||
'RATING/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 500, 'max': 10000000 }}},
|
|
||||||
'RHC/CNET': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 1000, 'max': 10000000 }}},
|
|
||||||
'SDA/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 20, 'max': 500000 }}},
|
|
||||||
'SDD/CKUSD': { 'precision': { 'amount': 2, 'price': 3 }, 'limits': { 'amount': { 'min': 10, 'max': 100000 }}},
|
|
||||||
'SHC/CNET': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 250, 'max': 2500000 }}},
|
|
||||||
'SHE/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 100, 'max': 5000000 }}},
|
|
||||||
'SMC/CNET': { 'precision': { 'amount': 2, 'price': 6 }, 'limits': { 'amount': { 'min': 1000, 'max': 10000000 }}},
|
|
||||||
'SOP/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 50, 'max': 1000000 }}},
|
|
||||||
'TAC/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 35, 'max': 800000 }}},
|
|
||||||
'TIP/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 7, 'max': 200000 }}},
|
|
||||||
'TKT/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 40, 'max': 400000 }}},
|
|
||||||
'TLC/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 500, 'max': 10000000 }}},
|
|
||||||
'TNC/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 10, 'max': 110000 }}},
|
|
||||||
'TUB/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 200, 'max': 8000000 }}},
|
|
||||||
'UC/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 100, 'max': 3000000 }}},
|
|
||||||
'UDB/CNET': { 'precision': { 'amount': 2, 'price': 6 }, 'limits': { 'amount': { 'min': 2000, 'max': 40000000 }}},
|
|
||||||
'UIC/CKUSD': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 5, 'max': 150000 }}},
|
|
||||||
'VAAC/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 10, 'max': 250000 }}},
|
|
||||||
'VPN/CNET': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 200, 'max': 2000000 }}},
|
|
||||||
'VSC/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 30, 'max': 650000 }}},
|
|
||||||
'WAVES/CKUSD': { 'precision': { 'amount': 2, 'price': 3 }, 'limits': { 'amount': { 'min': 0.15, 'max': 1500 }}},
|
|
||||||
'WDNA/ETH': { 'precision': { 'amount': 2, 'price': 8 }, 'limits': { 'amount': { 'min': 100, 'max': 250000 }}},
|
|
||||||
'WIC/CKUSD': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 3, 'max': 30000 }}},
|
|
||||||
'XAS/CNET': { 'precision': { 'amount': 2, 'price': 2 }, 'limits': { 'amount': { 'min': 2.5, 'max': 25000 }}},
|
|
||||||
'XLM/BTC': { 'precision': { 'amount': 4, 'price': 8 }, 'limits': { 'amount': { 'min': 10, 'max': 300000 }}},
|
|
||||||
'XLM/CKUSD': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 1, 'max': 300000 }}},
|
|
||||||
'XLM/USDT': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 5, 'max': 150000 }}},
|
|
||||||
'XRP/BTC': { 'precision': { 'amount': 4, 'price': 8 }, 'limits': { 'amount': { 'min': 24, 'max': 100000 }}},
|
|
||||||
'XRP/CKUSD': { 'precision': { 'amount': 2, 'price': 3 }, 'limits': { 'amount': { 'min': 5, 'max': 50000 }}},
|
|
||||||
'YBCT/BTC': { 'precision': { 'amount': 4, 'price': 8 }, 'limits': { 'amount': { 'min': 15, 'max': 200000 }}},
|
|
||||||
'YBCT/CKUSD': { 'precision': { 'amount': 2, 'price': 4 }, 'limits': { 'amount': { 'min': 10, 'max': 200000 }}},
|
|
||||||
'YBY/CNET': { 'precision': { 'amount': 2, 'price': 6 }, 'limits': { 'amount': { 'min': 25000, 'max': 250000000 }}},
|
|
||||||
'ZEC/BTC': { 'precision': { 'amount': 4, 'price': 8 }, 'limits': { 'amount': { 'min': 0.02, 'max': 100 }}},
|
|
||||||
'ZEC/CKUSD': { 'precision': { 'amount': 4, 'price': 2 }, 'limits': { 'amount': { 'min': 0.02, 'max': 100 }}},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchTradingLimits (symbols = undefined, params = {}) {
|
|
||||||
// this method should not be called directly, use loadTradingLimits () instead
|
|
||||||
// by default it will try load withdrawal fees of all currencies (with separate requests, sequentially)
|
|
||||||
// however if you define symbols = [ 'ETH/BTC', 'LTC/BTC' ] in args it will only load those
|
|
||||||
await this.loadMarkets ();
|
|
||||||
if (symbols === undefined) {
|
|
||||||
symbols = this.symbols;
|
|
||||||
}
|
|
||||||
const result = {};
|
|
||||||
for (let i = 0; i < symbols.length; i++) {
|
|
||||||
const symbol = symbols[i];
|
|
||||||
result[symbol] = await this.fetchTradingLimitsById (this.marketId (symbol), params);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchTradingLimitsById (id, params = {}) {
|
|
||||||
const request = {
|
|
||||||
'symbol': id,
|
|
||||||
};
|
|
||||||
const response = await this.publicPostApiOrderTicker (this.extend (request, params));
|
|
||||||
//
|
|
||||||
// { code: 0,
|
|
||||||
// msg: "获取牌价信息成功",
|
|
||||||
// data: { high: 0.03721392,
|
|
||||||
// low: 0.03335362,
|
|
||||||
// buy: "0.03525757",
|
|
||||||
// sell: "0.03531160",
|
|
||||||
// last: 0.0352634,
|
|
||||||
// vol: "184742.4176",
|
|
||||||
// min_trade: "0.01500000",
|
|
||||||
// max_trade: "100.00000000",
|
|
||||||
// number_float: "4",
|
|
||||||
// price_float: "8" } } }
|
|
||||||
//
|
|
||||||
return this.parseTradingLimits (this.safeValue (response, 'data', {}));
|
|
||||||
}
|
|
||||||
|
|
||||||
parseTradingLimits (limits, symbol = undefined, params = {}) {
|
|
||||||
//
|
|
||||||
// { high: 0.03721392,
|
|
||||||
// low: 0.03335362,
|
|
||||||
// buy: "0.03525757",
|
|
||||||
// sell: "0.03531160",
|
|
||||||
// last: 0.0352634,
|
|
||||||
// vol: "184742.4176",
|
|
||||||
// min_trade: "0.01500000",
|
|
||||||
// max_trade: "100.00000000",
|
|
||||||
// number_float: "4",
|
|
||||||
// price_float: "8" }
|
|
||||||
//
|
|
||||||
return {
|
|
||||||
'info': limits,
|
|
||||||
'precision': {
|
|
||||||
'amount': this.safeInteger (limits, 'number_float'),
|
|
||||||
'price': this.safeInteger (limits, 'price_float'),
|
|
||||||
},
|
|
||||||
'limits': {
|
|
||||||
'amount': {
|
|
||||||
'min': this.safeFloat (limits, 'min_trade'),
|
|
||||||
'max': this.safeFloat (limits, 'max_trade'),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchMarkets (params = {}) {
|
|
||||||
const response = await this.publicGetApiMarketGetPriceList (params);
|
|
||||||
const result = [];
|
|
||||||
const keys = Object.keys (response);
|
|
||||||
for (let i = 0; i < keys.length; i++) {
|
|
||||||
const currentMarketId = keys[i];
|
|
||||||
const currentMarkets = response[currentMarketId];
|
|
||||||
for (let j = 0; j < currentMarkets.length; j++) {
|
|
||||||
const market = currentMarkets[j];
|
|
||||||
const baseId = this.safeString (market, 'coin_from');
|
|
||||||
const quoteId = this.safeString (market, 'coin_to');
|
|
||||||
let base = baseId.toUpperCase ();
|
|
||||||
let quote = quoteId.toUpperCase ();
|
|
||||||
base = this.safeCurrencyCode (base);
|
|
||||||
quote = this.safeCurrencyCode (quote);
|
|
||||||
const id = baseId + '2' + quoteId;
|
|
||||||
const symbol = base + '/' + quote;
|
|
||||||
const active = true;
|
|
||||||
const defaults = this.safeValue (this.options['limits'], symbol, {});
|
|
||||||
result.push (this.extend ({
|
|
||||||
'id': id,
|
|
||||||
'symbol': symbol,
|
|
||||||
'base': base,
|
|
||||||
'quote': quote,
|
|
||||||
'baseId': baseId,
|
|
||||||
'quoteId': quoteId,
|
|
||||||
'active': active,
|
|
||||||
// overrided by defaults from this.options['limits']
|
|
||||||
'precision': {
|
|
||||||
'amount': undefined,
|
|
||||||
'price': undefined,
|
|
||||||
},
|
|
||||||
// overrided by defaults from this.options['limits']
|
|
||||||
'limits': {
|
|
||||||
'amount': { 'min': undefined, 'max': undefined },
|
|
||||||
'price': { 'min': undefined, 'max': undefined },
|
|
||||||
'cost': { 'min': undefined, 'max': undefined },
|
|
||||||
},
|
|
||||||
'info': market,
|
|
||||||
}, defaults));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
parseTrade (trade, market = undefined) {
|
|
||||||
let symbol = undefined;
|
|
||||||
if (market !== undefined) {
|
|
||||||
symbol = market['symbol'];
|
|
||||||
}
|
|
||||||
const timestamp = this.safeTimestamp2 (trade, 'date', 'created');
|
|
||||||
const id = this.safeString (trade, 'tid');
|
|
||||||
const orderId = this.safeString (trade, 'order_id');
|
|
||||||
const amount = this.safeFloat2 (trade, 'number', 'amount');
|
|
||||||
const price = this.safeFloat (trade, 'price');
|
|
||||||
let cost = undefined;
|
|
||||||
if (price !== undefined) {
|
|
||||||
if (amount !== undefined) {
|
|
||||||
cost = amount * price;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let side = this.safeString (trade, 'side');
|
|
||||||
if (side === 'sale') {
|
|
||||||
side = 'sell';
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
'info': trade,
|
|
||||||
'id': id,
|
|
||||||
'timestamp': timestamp,
|
|
||||||
'datetime': this.iso8601 (timestamp),
|
|
||||||
'symbol': symbol,
|
|
||||||
'type': undefined,
|
|
||||||
'side': side,
|
|
||||||
'price': price,
|
|
||||||
'amount': amount,
|
|
||||||
'cost': cost,
|
|
||||||
'order': orderId,
|
|
||||||
'fee': undefined,
|
|
||||||
'takerOrMaker': undefined,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
|
|
||||||
await this.loadMarkets ();
|
|
||||||
const request = {
|
|
||||||
'symbol': this.marketId (symbol),
|
|
||||||
};
|
|
||||||
if (limit !== undefined) {
|
|
||||||
request['limit'] = limit;
|
|
||||||
}
|
|
||||||
const market = this.market (symbol);
|
|
||||||
const response = await this.publicPostApiOrderMarketOrder (this.extend (request, params));
|
|
||||||
return this.parseTrades (response['data'], market, since, limit);
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchBalance (params = {}) {
|
|
||||||
await this.loadMarkets ();
|
|
||||||
const response = await this.privatePostApiUserUserBalance (params);
|
|
||||||
const data = this.safeValue (response, 'data');
|
|
||||||
let keys = Object.keys (data);
|
|
||||||
const result = { };
|
|
||||||
for (let i = 0; i < keys.length; i++) {
|
|
||||||
const key = keys[i];
|
|
||||||
const amount = this.safeFloat (data, key);
|
|
||||||
const parts = key.split ('_');
|
|
||||||
const currencyId = parts[0];
|
|
||||||
const lockOrOver = parts[1];
|
|
||||||
const code = this.safeCurrencyCode (currencyId);
|
|
||||||
if (!(code in result)) {
|
|
||||||
result[code] = this.account ();
|
|
||||||
}
|
|
||||||
if (lockOrOver === 'lock') {
|
|
||||||
result[code]['used'] = parseFloat (amount);
|
|
||||||
} else {
|
|
||||||
result[code]['free'] = parseFloat (amount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
keys = Object.keys (result);
|
|
||||||
for (let i = 0; i < keys.length; i++) {
|
|
||||||
const key = keys[i];
|
|
||||||
const total = this.sum (result[key]['used'], result[key]['free']);
|
|
||||||
result[key]['total'] = total;
|
|
||||||
}
|
|
||||||
result['info'] = data;
|
|
||||||
return this.parseBalance (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchTicker (symbol, params = {}) {
|
|
||||||
await this.loadMarkets ();
|
|
||||||
const market = this.markets[symbol];
|
|
||||||
const request = {
|
|
||||||
'part': market['quoteId'],
|
|
||||||
'coin': market['baseId'],
|
|
||||||
};
|
|
||||||
const response = await this.publicPostApiMarketGetCoinTrade (this.extend (request, params));
|
|
||||||
const timestamp = this.milliseconds ();
|
|
||||||
return {
|
|
||||||
'symbol': symbol,
|
|
||||||
'timestamp': timestamp,
|
|
||||||
'datetime': this.iso8601 (timestamp),
|
|
||||||
'high': this.safeFloat (response, 'max'),
|
|
||||||
'low': this.safeFloat (response, 'min'),
|
|
||||||
'bid': this.safeFloat (response, 'buy'),
|
|
||||||
'bidVolume': undefined,
|
|
||||||
'ask': this.safeFloat (response, 'sale'),
|
|
||||||
'askVolume': undefined,
|
|
||||||
'vwap': undefined,
|
|
||||||
'open': undefined,
|
|
||||||
'close': this.safeFloat (response, 'price'),
|
|
||||||
'last': this.safeFloat (response, 'price'),
|
|
||||||
'previousClose': undefined,
|
|
||||||
'change': undefined,
|
|
||||||
'percentage': this.safeFloat (response, 'change_24h'),
|
|
||||||
'average': undefined,
|
|
||||||
'baseVolume': this.safeFloat (response, 'volume_24h'),
|
|
||||||
'quoteVolume': undefined,
|
|
||||||
'info': response,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchOrderBook (symbol, limit = undefined, params = {}) {
|
|
||||||
await this.loadMarkets ();
|
|
||||||
const marketId = this.marketId (symbol);
|
|
||||||
const request = {
|
|
||||||
'symbol': marketId,
|
|
||||||
};
|
|
||||||
const response = await this.publicPostApiOrderDepth (this.extend (request, params));
|
|
||||||
const data = this.safeValue (response, 'data');
|
|
||||||
const timestamp = this.safeTimestamp (data, 'date');
|
|
||||||
return this.parseOrderBook (data, timestamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
||||||
await this.loadMarkets ();
|
|
||||||
const market = this.market (symbol);
|
|
||||||
const request = {
|
|
||||||
'symbol': market['id'],
|
|
||||||
};
|
|
||||||
const response = await this.privatePostApiOrderOrderList (this.extend (request, params));
|
|
||||||
return this.parseTrades (response['data'], market, since, limit);
|
|
||||||
}
|
|
||||||
|
|
||||||
parseOrderStatus (status) {
|
|
||||||
const statuses = {
|
|
||||||
'0': 'open',
|
|
||||||
'1': 'open', // partially filled
|
|
||||||
'2': 'closed',
|
|
||||||
'3': 'canceled',
|
|
||||||
};
|
|
||||||
return this.safeString (statuses, status, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchOrder (id, symbol = undefined, params = {}) {
|
|
||||||
if (symbol === undefined) {
|
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrder requires a `symbol` argument');
|
|
||||||
}
|
|
||||||
await this.loadMarkets ();
|
|
||||||
const request = {
|
|
||||||
'symbol': this.marketId (symbol),
|
|
||||||
'trust_id': id,
|
|
||||||
};
|
|
||||||
const response = await this.privatePostApiOrderOrderInfo (this.extend (request, params));
|
|
||||||
const order = this.safeValue (response, 'data');
|
|
||||||
const timestamp = this.safeTimestamp (order, 'created');
|
|
||||||
const status = this.parseOrderStatus (this.safeString (order, 'status'));
|
|
||||||
let side = this.safeString (order, 'flag');
|
|
||||||
if (side === 'sale') {
|
|
||||||
side = 'sell';
|
|
||||||
}
|
|
||||||
// Can't use parseOrder because the data format is different btw endpoint for fetchOrder and fetchOrders
|
|
||||||
return {
|
|
||||||
'info': order,
|
|
||||||
'id': id,
|
|
||||||
'timestamp': timestamp,
|
|
||||||
'datetime': this.iso8601 (timestamp),
|
|
||||||
'lastTradeTimestamp': undefined,
|
|
||||||
'symbol': symbol,
|
|
||||||
'type': undefined,
|
|
||||||
'side': side,
|
|
||||||
'price': this.safeFloat (order, 'price'),
|
|
||||||
'cost': undefined,
|
|
||||||
'average': this.safeFloat (order, 'avg_price'),
|
|
||||||
'amount': this.safeFloat (order, 'number'),
|
|
||||||
'filled': this.safeFloat (order, 'numberdeal'),
|
|
||||||
'remaining': this.safeFloat (order, 'numberover'),
|
|
||||||
'status': status,
|
|
||||||
'fee': undefined,
|
|
||||||
'clientOrderId': undefined,
|
|
||||||
'trades': undefined,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
parseOrder (order, market = undefined) {
|
|
||||||
const id = this.safeString (order, 'id');
|
|
||||||
const timestamp = this.safeTimestamp (order, 'datetime');
|
|
||||||
let symbol = undefined;
|
|
||||||
if (market !== undefined) {
|
|
||||||
symbol = market['symbol'];
|
|
||||||
}
|
|
||||||
const type = undefined;
|
|
||||||
let side = this.safeString (order, 'type');
|
|
||||||
if (side === 'sale') {
|
|
||||||
side = 'sell';
|
|
||||||
}
|
|
||||||
const price = this.safeFloat (order, 'price');
|
|
||||||
const average = this.safeFloat (order, 'avg_price');
|
|
||||||
const amount = this.safeFloat (order, 'amount');
|
|
||||||
const remaining = this.safeFloat (order, 'amount_outstanding');
|
|
||||||
const filled = amount - remaining;
|
|
||||||
const status = this.parseOrderStatus (this.safeString (order, 'status'));
|
|
||||||
const cost = filled * price;
|
|
||||||
const fee = undefined;
|
|
||||||
const result = {
|
|
||||||
'info': order,
|
|
||||||
'id': id,
|
|
||||||
'clientOrderId': undefined,
|
|
||||||
'timestamp': timestamp,
|
|
||||||
'datetime': this.iso8601 (timestamp),
|
|
||||||
'lastTradeTimestamp': undefined,
|
|
||||||
'symbol': symbol,
|
|
||||||
'type': type,
|
|
||||||
'timeInForce': undefined,
|
|
||||||
'side': side,
|
|
||||||
'price': price,
|
|
||||||
'stopPrice': undefined,
|
|
||||||
'cost': cost,
|
|
||||||
'average': average,
|
|
||||||
'amount': amount,
|
|
||||||
'filled': filled,
|
|
||||||
'remaining': remaining,
|
|
||||||
'status': status,
|
|
||||||
'fee': fee,
|
|
||||||
'trades': undefined,
|
|
||||||
};
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchOrdersByType (type, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
||||||
await this.loadMarkets ();
|
|
||||||
const request = {
|
|
||||||
'type': type,
|
|
||||||
};
|
|
||||||
let market = undefined;
|
|
||||||
if (symbol !== undefined) {
|
|
||||||
market = this.market (symbol);
|
|
||||||
request['symbol'] = market['id'];
|
|
||||||
}
|
|
||||||
const response = await this.privatePostApiOrderTradeList (this.extend (request, params));
|
|
||||||
if ('data' in response) {
|
|
||||||
return this.parseOrders (response['data'], market, since, limit);
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
||||||
return this.fetchOrdersByType ('open', symbol, since, limit, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
||||||
const orders = await this.fetchOrders (symbol, since, limit, params);
|
|
||||||
return this.filterBy (orders, 'status', 'closed');
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
||||||
return this.fetchOrdersByType ('all', symbol, since, limit, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
async createOrder (symbol, type, side, amount, price = undefined, params = {}) {
|
|
||||||
await this.loadMarkets ();
|
|
||||||
const request = {
|
|
||||||
'symbol': this.marketId (symbol),
|
|
||||||
'type': side,
|
|
||||||
'price': this.priceToPrecision (symbol, price),
|
|
||||||
'number': this.amountToPrecision (symbol, amount),
|
|
||||||
};
|
|
||||||
const response = await this.privatePostApiOrderCoinTrust (this.extend (request, params));
|
|
||||||
const data = this.safeValue (response, 'data', {});
|
|
||||||
const id = this.safeString (data, 'order_id');
|
|
||||||
return {
|
|
||||||
'info': response,
|
|
||||||
'id': id,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
|
||||||
if (symbol === undefined) {
|
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires a `symbol` argument');
|
|
||||||
}
|
|
||||||
await this.loadMarkets ();
|
|
||||||
const request = {};
|
|
||||||
if (symbol !== undefined) {
|
|
||||||
request['symbol'] = this.marketId (symbol);
|
|
||||||
}
|
|
||||||
if (id !== undefined) {
|
|
||||||
request['order_id'] = id;
|
|
||||||
}
|
|
||||||
return await this.privatePostApiOrderCancel (this.extend (request, params));
|
|
||||||
}
|
|
||||||
|
|
||||||
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
||||||
let url = this.urls['api'] + '/' + this.implodeParams (path, params);
|
|
||||||
const query = this.omit (params, this.extractParams (path));
|
|
||||||
if (api === 'public') {
|
|
||||||
if (Object.keys (query).length) {
|
|
||||||
url += '?' + this.urlencode (query);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.checkRequiredCredentials ();
|
|
||||||
let payload = this.urlencode ({ 'api_key': this.apiKey });
|
|
||||||
if (Object.keys (query).length) {
|
|
||||||
payload += '&' + this.urlencode (this.keysort (query));
|
|
||||||
}
|
|
||||||
const auth = payload + '&secret_key=' + this.secret;
|
|
||||||
const signature = this.hash (this.encode (auth));
|
|
||||||
body = payload + '&sign=' + signature;
|
|
||||||
headers = {
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
||||||
}
|
|
||||||
|
|
||||||
handleErrors (code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
||||||
if (response === undefined) {
|
|
||||||
return; // fallback to default error handler
|
|
||||||
}
|
|
||||||
const errorCode = this.safeValue (response, 'code');
|
|
||||||
if (errorCode !== undefined) {
|
|
||||||
if (errorCode !== 0) {
|
|
||||||
//
|
|
||||||
// { code: 1, msg: "该币不存在,非法操作" } - returned when a required symbol parameter is missing in the request (also, maybe on other types of errors as well)
|
|
||||||
// { code: 1, msg: '公钥不合法' } - wrong public key
|
|
||||||
// { code: 1, msg: '价格输入有误,请检查你的数值精度' } - 'The price input is incorrect, please check your numerical accuracy'
|
|
||||||
// { code: 1, msg: '单笔最小交易数量不能小于0.00100000,请您重新挂单'} -
|
|
||||||
// 'The minimum number of single transactions cannot be less than 0.00100000. Please re-post the order'
|
|
||||||
//
|
|
||||||
const message = this.safeString (response, 'msg');
|
|
||||||
const feedback = this.id + ' ' + message;
|
|
||||||
this.throwExactlyMatchedException (this.exceptions, message, feedback);
|
|
||||||
if (message.indexOf ('请您重新挂单') >= 0) { // minimum limit
|
|
||||||
throw new InvalidOrder (feedback);
|
|
||||||
} else {
|
|
||||||
throw new ExchangeError (feedback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Generated
Vendored
+125
-44
@@ -3,7 +3,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const Exchange = require ('./base/Exchange');
|
const Exchange = require ('./base/Exchange');
|
||||||
const { ExchangeError, AccountSuspended, ArgumentsRequired, AuthenticationError, DDoSProtection, ExchangeNotAvailable, InvalidOrder, OrderNotFound, PermissionDenied, InsufficientFunds, BadSymbol } = require ('./base/errors');
|
const { ExchangeError, AccountSuspended, ArgumentsRequired, AuthenticationError, DDoSProtection, ExchangeNotAvailable, InvalidOrder, OrderNotFound, PermissionDenied, InsufficientFunds, BadSymbol, RateLimitExceeded, BadRequest } = require ('./base/errors');
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -71,6 +71,7 @@ module.exports = class bibox extends Exchange {
|
|||||||
'get': [
|
'get': [
|
||||||
'cquery',
|
'cquery',
|
||||||
'mdata',
|
'mdata',
|
||||||
|
'cdata',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'private': {
|
'private': {
|
||||||
@@ -108,9 +109,16 @@ module.exports = class bibox extends Exchange {
|
|||||||
'2021': InsufficientFunds, // Insufficient balance available for withdrawal
|
'2021': InsufficientFunds, // Insufficient balance available for withdrawal
|
||||||
'2027': InsufficientFunds, // Insufficient balance available (for trade)
|
'2027': InsufficientFunds, // Insufficient balance available (for trade)
|
||||||
'2033': OrderNotFound, // operation failed! Orders have been completed or revoked
|
'2033': OrderNotFound, // operation failed! Orders have been completed or revoked
|
||||||
|
'2065': InvalidOrder, // Precatory price is exorbitant, please reset
|
||||||
|
'2066': InvalidOrder, // Precatory price is low, please reset
|
||||||
'2067': InvalidOrder, // Does not support market orders
|
'2067': InvalidOrder, // Does not support market orders
|
||||||
'2068': InvalidOrder, // The number of orders can not be less than
|
'2068': InvalidOrder, // The number of orders can not be less than
|
||||||
|
'2078': InvalidOrder, // unvalid order price
|
||||||
'2085': InvalidOrder, // Order quantity is too small
|
'2085': InvalidOrder, // Order quantity is too small
|
||||||
|
'2091': RateLimitExceeded, // request is too frequency, please try again later
|
||||||
|
'2092': InvalidOrder, // Minimum amount not met
|
||||||
|
'3000': BadRequest, // Requested parameter incorrect
|
||||||
|
'3002': BadRequest, // Parameter cannot be null
|
||||||
'3012': AuthenticationError, // invalid apiKey
|
'3012': AuthenticationError, // invalid apiKey
|
||||||
'3016': BadSymbol, // Trading pair error
|
'3016': BadSymbol, // Trading pair error
|
||||||
'3024': PermissionDenied, // wrong apikey permissions
|
'3024': PermissionDenied, // wrong apikey permissions
|
||||||
@@ -124,6 +132,10 @@ module.exports = class bibox extends Exchange {
|
|||||||
'KEY': 'Bihu',
|
'KEY': 'Bihu',
|
||||||
'MTC': 'MTC Mesh Network', // conflict with MTC Docademic doc.com Token https://github.com/ccxt/ccxt/issues/6081 https://github.com/ccxt/ccxt/issues/3025
|
'MTC': 'MTC Mesh Network', // conflict with MTC Docademic doc.com Token https://github.com/ccxt/ccxt/issues/6081 https://github.com/ccxt/ccxt/issues/3025
|
||||||
'PAI': 'PCHAIN',
|
'PAI': 'PCHAIN',
|
||||||
|
'TERN': 'Ternio-ERC20',
|
||||||
|
},
|
||||||
|
'options': {
|
||||||
|
'fetchCurrencies': 'fetch_currencies_public', // or 'fetch_currencies_private' with apiKey and secret
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -423,6 +435,78 @@ module.exports = class bibox extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchCurrencies (params = {}) {
|
async fetchCurrencies (params = {}) {
|
||||||
|
const method = this.safeString (this.options, 'fetchCurrencies', 'fetch_currencies_public');
|
||||||
|
return await this[method] (params);
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchCurrenciesPublic (params = {}) {
|
||||||
|
const request = {
|
||||||
|
'cmd': 'currencies',
|
||||||
|
};
|
||||||
|
const response = await this.publicGetCdata (this.extend (request, params));
|
||||||
|
//
|
||||||
|
// publicGetCdata
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "result":[
|
||||||
|
// {
|
||||||
|
// "symbol":"BTC",
|
||||||
|
// "name":"BTC",
|
||||||
|
// "valid_decimals":8,
|
||||||
|
// "original_decimals":8,
|
||||||
|
// "is_erc20":0,
|
||||||
|
// "enable_withdraw":1,
|
||||||
|
// "enable_deposit":1,
|
||||||
|
// "withdraw_min":0.005,
|
||||||
|
// "describe_summary":"[{\"lang\":\"zh-cn\",\"text\":\"Bitcoin 比特币的概念最初由中本聪在2009年提出,是点对点的基于 SHA-256 算法的一种P2P形式的数字货币,点对点的传输意味着一个去中心化的支付系统。\"},{\"lang\":\"en-ww\",\"text\":\"Bitcoin is a digital asset and a payment system invented by Satoshi Nakamoto who published a related paper in 2008 and released it as open-source software in 2009. The system featured as peer-to-peer; users can transact directly without an intermediary.\"}]"
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// "cmd":"currencies"
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
const currencies = this.safeValue (response, 'result');
|
||||||
|
const result = {};
|
||||||
|
for (let i = 0; i < currencies.length; i++) {
|
||||||
|
const currency = currencies[i];
|
||||||
|
const id = this.safeString (currency, 'symbol');
|
||||||
|
const name = this.safeString (currency, 'name'); // contains hieroglyphs causing python ASCII bug
|
||||||
|
const code = this.safeCurrencyCode (id);
|
||||||
|
const precision = this.safeInteger (currency, 'valid_decimals');
|
||||||
|
const deposit = this.safeValue (currency, 'enable_deposit');
|
||||||
|
const withdraw = this.safeValue (currency, 'enable_withdraw');
|
||||||
|
const active = (deposit && withdraw);
|
||||||
|
result[code] = {
|
||||||
|
'id': id,
|
||||||
|
'code': code,
|
||||||
|
'info': currency,
|
||||||
|
'name': name,
|
||||||
|
'active': active,
|
||||||
|
'fee': undefined,
|
||||||
|
'precision': precision,
|
||||||
|
'limits': {
|
||||||
|
'amount': {
|
||||||
|
'min': Math.pow (10, -precision),
|
||||||
|
'max': undefined,
|
||||||
|
},
|
||||||
|
'price': {
|
||||||
|
'min': Math.pow (10, -precision),
|
||||||
|
'max': undefined,
|
||||||
|
},
|
||||||
|
'cost': {
|
||||||
|
'min': undefined,
|
||||||
|
'max': undefined,
|
||||||
|
},
|
||||||
|
'withdraw': {
|
||||||
|
'min': this.safeFloat (currency, 'withdraw_min'),
|
||||||
|
'max': undefined,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchCurrenciesPrivate (params = {}) {
|
||||||
if (!this.apiKey || !this.secret) {
|
if (!this.apiKey || !this.secret) {
|
||||||
throw new AuthenticationError (this.id + " fetchCurrencies is an authenticated endpoint, therefore it requires 'apiKey' and 'secret' credentials. If you don't need currency details, set exchange.has['fetchCurrencies'] = false before calling its methods.");
|
throw new AuthenticationError (this.id + " fetchCurrencies is an authenticated endpoint, therefore it requires 'apiKey' and 'secret' credentials. If you don't need currency details, set exchange.has['fetchCurrencies'] = false before calling its methods.");
|
||||||
}
|
}
|
||||||
@@ -435,46 +519,42 @@ module.exports = class bibox extends Exchange {
|
|||||||
// {
|
// {
|
||||||
// "result":[
|
// "result":[
|
||||||
// {
|
// {
|
||||||
// "result":[
|
// "totalBalance":"14.57582269",
|
||||||
// {
|
// "balance":"14.57582269",
|
||||||
// "totalBalance":"14.57582269",
|
// "freeze":"0.00000000",
|
||||||
// "balance":"14.57582269",
|
// "id":60,
|
||||||
// "freeze":"0.00000000",
|
// "symbol":"USDT",
|
||||||
// "id":60,
|
// "icon_url":"/appimg/USDT_icon.png",
|
||||||
// "symbol":"USDT",
|
// "describe_url":"[{\"lang\":\"zh-cn\",\"link\":\"https://bibox.zendesk.com/hc/zh-cn/articles/115004798234\"},{\"lang\":\"en-ww\",\"link\":\"https://bibox.zendesk.com/hc/en-us/articles/115004798234\"}]",
|
||||||
// "icon_url":"/appimg/USDT_icon.png",
|
// "name":"USDT",
|
||||||
// "describe_url":"[{\"lang\":\"zh-cn\",\"link\":\"https://bibox.zendesk.com/hc/zh-cn/articles/115004798234\"},{\"lang\":\"en-ww\",\"link\":\"https://bibox.zendesk.com/hc/en-us/articles/115004798234\"}]",
|
// "enable_withdraw":1,
|
||||||
// "name":"USDT",
|
// "enable_deposit":1,
|
||||||
// "enable_withdraw":1,
|
// "enable_transfer":1,
|
||||||
// "enable_deposit":1,
|
// "confirm_count":2,
|
||||||
// "enable_transfer":1,
|
// "is_erc20":1,
|
||||||
// "confirm_count":2,
|
// "forbid_info":null,
|
||||||
// "is_erc20":1,
|
// "describe_summary":"[{\"lang\":\"zh-cn\",\"text\":\"USDT 是 Tether 公司推出的基于稳定价值货币美元(USD)的代币 Tether USD(简称USDT),1USDT=1美元,用户可以随时使用 USDT 与 USD 进行1:1的兑换。\"},{\"lang\":\"en-ww\",\"text\":\"USDT is a cryptocurrency asset issued on the Bitcoin blockchain via the Omni Layer Protocol. Each USDT unit is backed by a U.S Dollar held in the reserves of the Tether Limited and can be redeemed through the Tether Platform.\"}]",
|
||||||
// "forbid_info":null,
|
// "total_amount":4776930644,
|
||||||
// "describe_summary":"[{\"lang\":\"zh-cn\",\"text\":\"USDT 是 Tether 公司推出的基于稳定价值货币美元(USD)的代币 Tether USD(简称USDT),1USDT=1美元,用户可以随时使用 USDT 与 USD 进行1:1的兑换。\"},{\"lang\":\"en-ww\",\"text\":\"USDT is a cryptocurrency asset issued on the Bitcoin blockchain via the Omni Layer Protocol. Each USDT unit is backed by a U.S Dollar held in the reserves of the Tether Limited and can be redeemed through the Tether Platform.\"}]",
|
// "supply_amount":4642367414,
|
||||||
// "total_amount":4776930644,
|
// "price":"--",
|
||||||
// "supply_amount":4642367414,
|
// "contract_father":"OMNI",
|
||||||
// "price":"--",
|
// "supply_time":"--",
|
||||||
// "contract_father":"OMNI",
|
// "comment":null,
|
||||||
// "supply_time":"--",
|
// "contract":"31",
|
||||||
// "comment":null,
|
// "original_decimals":8,
|
||||||
// "contract":"31",
|
// "deposit_type":0,
|
||||||
// "original_decimals":8,
|
// "hasCobo":0,
|
||||||
// "deposit_type":0,
|
// "BTCValue":"0.00126358",
|
||||||
// "hasCobo":0,
|
// "CNYValue":"100.93381445",
|
||||||
// "BTCValue":"0.00126358",
|
// "USDValue":"14.57524654",
|
||||||
// "CNYValue":"100.93381445",
|
// "children":[
|
||||||
// "USDValue":"14.57524654",
|
// {"type":"OMNI","symbol":"USDT","enable_deposit":1,"enable_withdraw":1,"confirm_count":2},
|
||||||
// "children":[
|
// {"type":"TRC20","symbol":"tUSDT","enable_deposit":1,"enable_withdraw":1,"confirm_count":20},
|
||||||
// {"type":"OMNI","symbol":"USDT","enable_deposit":1,"enable_withdraw":1,"confirm_count":2},
|
// {"type":"ERC20","symbol":"eUSDT","enable_deposit":1,"enable_withdraw":1,"confirm_count":25}
|
||||||
// {"type":"TRC20","symbol":"tUSDT","enable_deposit":1,"enable_withdraw":1,"confirm_count":20},
|
// ]
|
||||||
// {"type":"ERC20","symbol":"eUSDT","enable_deposit":1,"enable_withdraw":1,"confirm_count":25}
|
// },
|
||||||
// ]
|
// ],
|
||||||
// },
|
// "cmd":"transfer/coinList"
|
||||||
// ],
|
|
||||||
// "cmd":"transfer/coinList"
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
const currencies = this.safeValue (response, 'result');
|
const currencies = this.safeValue (response, 'result');
|
||||||
@@ -799,6 +879,7 @@ module.exports = class bibox extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -851,7 +932,7 @@ module.exports = class bibox extends Exchange {
|
|||||||
|
|
||||||
async fetchClosedOrders (symbol = undefined, since = undefined, limit = 200, params = {}) {
|
async fetchClosedOrders (symbol = undefined, since = undefined, limit = 200, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchClosedOrders requires a `symbol` argument');
|
throw new ArgumentsRequired (this.id + ' fetchClosedOrders() requires a `symbol` argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -871,7 +952,7 @@ module.exports = class bibox extends Exchange {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a `symbol` argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a `symbol` argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -998,7 +1079,7 @@ module.exports = class bibox extends Exchange {
|
|||||||
}
|
}
|
||||||
} else if (api === 'v2private') {
|
} else if (api === 'v2private') {
|
||||||
this.checkRequiredCredentials ();
|
this.checkRequiredCredentials ();
|
||||||
url = this.urls['api'] + '/v2/' + path;
|
url = this.implodeParams (this.urls['api'], { 'hostname': this.hostname }) + '/v2/' + path;
|
||||||
const json_params = this.json (params);
|
const json_params = this.json (params);
|
||||||
body = {
|
body = {
|
||||||
'body': json_params,
|
'body': json_params,
|
||||||
|
|||||||
Generated
Vendored
+8
-2
@@ -78,6 +78,7 @@ module.exports = class bigone extends Exchange {
|
|||||||
'private': {
|
'private': {
|
||||||
'get': [
|
'get': [
|
||||||
'accounts',
|
'accounts',
|
||||||
|
'fund/accounts',
|
||||||
'assets/{asset_symbol}/address',
|
'assets/{asset_symbol}/address',
|
||||||
'orders',
|
'orders',
|
||||||
'orders/{id}',
|
'orders/{id}',
|
||||||
@@ -91,6 +92,7 @@ module.exports = class bigone extends Exchange {
|
|||||||
'orders/{id}/cancel',
|
'orders/{id}/cancel',
|
||||||
'orders/cancel',
|
'orders/cancel',
|
||||||
'withdrawals',
|
'withdrawals',
|
||||||
|
'transfer',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -645,7 +647,10 @@ module.exports = class bigone extends Exchange {
|
|||||||
|
|
||||||
async fetchBalance (params = {}) {
|
async fetchBalance (params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const response = await this.privateGetAccounts (params);
|
const type = this.safeString (params, 'type', '');
|
||||||
|
params = this.omit (params, 'type');
|
||||||
|
const method = 'privateGet' + this.capitalize (type) + 'Accounts';
|
||||||
|
const response = await this[method] (params);
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// "code":0,
|
// "code":0,
|
||||||
@@ -721,6 +726,7 @@ module.exports = class bigone extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': undefined,
|
'type': undefined,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -758,7 +764,7 @@ module.exports = class bigone extends Exchange {
|
|||||||
if (isStopLimit || isStopMarket) {
|
if (isStopLimit || isStopMarket) {
|
||||||
const stopPrice = this.safeFloat2 (params, 'stop_price', 'stopPrice');
|
const stopPrice = this.safeFloat2 (params, 'stop_price', 'stopPrice');
|
||||||
if (stopPrice === undefined) {
|
if (stopPrice === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' createOrder requires a stop_price parameter');
|
throw new ArgumentsRequired (this.id + ' createOrder() requires a stop_price parameter');
|
||||||
}
|
}
|
||||||
request['stop_price'] = this.priceToPrecision (symbol, stopPrice);
|
request['stop_price'] = this.priceToPrecision (symbol, stopPrice);
|
||||||
params = this.omit (params, [ 'stop_price', 'stopPrice' ]);
|
params = this.omit (params, [ 'stop_price', 'stopPrice' ]);
|
||||||
|
|||||||
Generated
Vendored
+289
-33
@@ -3,7 +3,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const Exchange = require ('./base/Exchange');
|
const Exchange = require ('./base/Exchange');
|
||||||
const { ExchangeError, ArgumentsRequired, ExchangeNotAvailable, InsufficientFunds, OrderNotFound, InvalidOrder, DDoSProtection, InvalidNonce, AuthenticationError, InvalidAddress, RateLimitExceeded, PermissionDenied, NotSupported, BadRequest, BadSymbol, AccountSuspended, OrderImmediatelyFillable } = require ('./base/errors');
|
const { ExchangeError, ArgumentsRequired, ExchangeNotAvailable, InsufficientFunds, OrderNotFound, InvalidOrder, DDoSProtection, InvalidNonce, AuthenticationError, RateLimitExceeded, PermissionDenied, NotSupported, BadRequest, BadSymbol, AccountSuspended, OrderImmediatelyFillable } = require ('./base/errors');
|
||||||
const { ROUND, TRUNCATE } = require ('./base/functions/number');
|
const { ROUND, TRUNCATE } = require ('./base/functions/number');
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -23,6 +23,7 @@ module.exports = class binance extends Exchange {
|
|||||||
'cancelOrder': true,
|
'cancelOrder': true,
|
||||||
'CORS': false,
|
'CORS': false,
|
||||||
'createOrder': true,
|
'createOrder': true,
|
||||||
|
'fetchCurrencies': true,
|
||||||
'fetchBalance': true,
|
'fetchBalance': true,
|
||||||
'fetchBidsAsks': true,
|
'fetchBidsAsks': true,
|
||||||
'fetchClosedOrders': 'emulated',
|
'fetchClosedOrders': 'emulated',
|
||||||
@@ -113,6 +114,7 @@ module.exports = class binance extends Exchange {
|
|||||||
'margin/priceIndex',
|
'margin/priceIndex',
|
||||||
// these endpoints require this.apiKey + this.secret
|
// these endpoints require this.apiKey + this.secret
|
||||||
'asset/assetDividend',
|
'asset/assetDividend',
|
||||||
|
'asset/transfer',
|
||||||
'margin/loan',
|
'margin/loan',
|
||||||
'margin/repay',
|
'margin/repay',
|
||||||
'margin/account',
|
'margin/account',
|
||||||
@@ -154,6 +156,7 @@ module.exports = class binance extends Exchange {
|
|||||||
'sub-account/spotSummary',
|
'sub-account/spotSummary',
|
||||||
'sub-account/status',
|
'sub-account/status',
|
||||||
'sub-account/transfer/subUserHistory',
|
'sub-account/transfer/subUserHistory',
|
||||||
|
'sub-account/universalTransfer',
|
||||||
// lending endpoints
|
// lending endpoints
|
||||||
'lending/daily/product/list',
|
'lending/daily/product/list',
|
||||||
'lending/daily/userLeftQuota',
|
'lending/daily/userLeftQuota',
|
||||||
@@ -179,9 +182,23 @@ module.exports = class binance extends Exchange {
|
|||||||
'bswap/liquidityOps',
|
'bswap/liquidityOps',
|
||||||
'bswap/quote',
|
'bswap/quote',
|
||||||
'bswap/swap',
|
'bswap/swap',
|
||||||
|
// leveraged token endpoints
|
||||||
|
'blvt/tokenInfo',
|
||||||
|
'blvt/subscribe/record',
|
||||||
|
'blvt/redeem/record',
|
||||||
|
'blvt/userLimit',
|
||||||
|
// broker api
|
||||||
|
'apiReferral/ifNewUser',
|
||||||
|
'apiReferral/customization',
|
||||||
|
'apiReferral/userCustomization',
|
||||||
|
'apiReferral/rebate/recentRecord',
|
||||||
|
'apiReferral/rebate/historicalRecord',
|
||||||
|
'apiReferral/kickback/recentRecord',
|
||||||
|
'apiReferral/kickback/historicalRecord',
|
||||||
],
|
],
|
||||||
'post': [
|
'post': [
|
||||||
'asset/dust',
|
'asset/dust',
|
||||||
|
'asset/transfer',
|
||||||
'account/disableFastWithdrawSwitch',
|
'account/disableFastWithdrawSwitch',
|
||||||
'account/enableFastWithdrawSwitch',
|
'account/enableFastWithdrawSwitch',
|
||||||
'capital/withdraw/apply',
|
'capital/withdraw/apply',
|
||||||
@@ -199,6 +216,7 @@ module.exports = class binance extends Exchange {
|
|||||||
'sub-account/futures/internalTransfer',
|
'sub-account/futures/internalTransfer',
|
||||||
'sub-account/transfer/subToSub',
|
'sub-account/transfer/subToSub',
|
||||||
'sub-account/transfer/subToMaster',
|
'sub-account/transfer/subToMaster',
|
||||||
|
'sub-account/universalTransfer',
|
||||||
'userDataStream',
|
'userDataStream',
|
||||||
'userDataStream/isolated',
|
'userDataStream/isolated',
|
||||||
'futures/transfer',
|
'futures/transfer',
|
||||||
@@ -213,12 +231,21 @@ module.exports = class binance extends Exchange {
|
|||||||
'bswap/liquidityAdd',
|
'bswap/liquidityAdd',
|
||||||
'bswap/liquidityRemove',
|
'bswap/liquidityRemove',
|
||||||
'bswap/swap',
|
'bswap/swap',
|
||||||
|
// leveraged token endpoints
|
||||||
|
'blvt/subscribe',
|
||||||
|
'blvt/redeem',
|
||||||
|
// broker api
|
||||||
|
'apiReferral/customization',
|
||||||
|
'apiReferral/userCustomization',
|
||||||
|
'apiReferral/rebate/historicalRecord',
|
||||||
|
'apiReferral/kickback/historicalRecord',
|
||||||
],
|
],
|
||||||
'put': [
|
'put': [
|
||||||
'userDataStream',
|
'userDataStream',
|
||||||
'userDataStream/isolated',
|
'userDataStream/isolated',
|
||||||
],
|
],
|
||||||
'delete': [
|
'delete': [
|
||||||
|
'margin/openOrders',
|
||||||
'margin/order',
|
'margin/order',
|
||||||
'userDataStream',
|
'userDataStream',
|
||||||
'userDataStream/isolated',
|
'userDataStream/isolated',
|
||||||
@@ -323,6 +350,7 @@ module.exports = class binance extends Exchange {
|
|||||||
'historicalTrades',
|
'historicalTrades',
|
||||||
'aggTrades',
|
'aggTrades',
|
||||||
'klines',
|
'klines',
|
||||||
|
'continuousKlines',
|
||||||
'fundingRate',
|
'fundingRate',
|
||||||
'premiumIndex',
|
'premiumIndex',
|
||||||
'ticker/24hr',
|
'ticker/24hr',
|
||||||
@@ -357,6 +385,15 @@ module.exports = class binance extends Exchange {
|
|||||||
'positionSide/dual',
|
'positionSide/dual',
|
||||||
'userTrades',
|
'userTrades',
|
||||||
'income',
|
'income',
|
||||||
|
// broker endpoints
|
||||||
|
'apiReferral/ifNewUser',
|
||||||
|
'apiReferral/customization',
|
||||||
|
'apiReferral/userCustomization',
|
||||||
|
'apiReferral/traderNum',
|
||||||
|
'apiReferral/overview',
|
||||||
|
'apiReferral/tradeVol',
|
||||||
|
'apiReferral/rebateVol',
|
||||||
|
'apiReferral/traderSummary',
|
||||||
],
|
],
|
||||||
'post': [
|
'post': [
|
||||||
'batchOrders',
|
'batchOrders',
|
||||||
@@ -367,6 +404,9 @@ module.exports = class binance extends Exchange {
|
|||||||
'leverage',
|
'leverage',
|
||||||
'listenKey',
|
'listenKey',
|
||||||
'countdownCancelAll',
|
'countdownCancelAll',
|
||||||
|
// broker endpoints
|
||||||
|
'apiReferral/customization',
|
||||||
|
'apiReferral/userCustomization',
|
||||||
],
|
],
|
||||||
'put': [
|
'put': [
|
||||||
'listenKey',
|
'listenKey',
|
||||||
@@ -446,6 +486,7 @@ module.exports = class binance extends Exchange {
|
|||||||
},
|
},
|
||||||
// exchange-specific options
|
// exchange-specific options
|
||||||
'options': {
|
'options': {
|
||||||
|
'fetchCurrencies': false, // this is a private call and it requires API keys
|
||||||
// 'fetchTradesMethod': 'publicGetAggTrades', // publicGetTrades, publicGetHistoricalTrades
|
// 'fetchTradesMethod': 'publicGetAggTrades', // publicGetTrades, publicGetHistoricalTrades
|
||||||
'defaultTimeInForce': 'GTC', // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
|
'defaultTimeInForce': 'GTC', // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
|
||||||
'defaultType': 'spot', // 'spot', 'future', 'margin', 'delivery'
|
'defaultType': 'spot', // 'spot', 'future', 'margin', 'delivery'
|
||||||
@@ -460,11 +501,20 @@ module.exports = class binance extends Exchange {
|
|||||||
'limit': 'RESULT', // we change it from 'ACK' by default to 'RESULT'
|
'limit': 'RESULT', // we change it from 'ACK' by default to 'RESULT'
|
||||||
},
|
},
|
||||||
'quoteOrderQty': true, // whether market orders support amounts in quote currency
|
'quoteOrderQty': true, // whether market orders support amounts in quote currency
|
||||||
|
'broker': {
|
||||||
|
'spot': 'x-R4BD3S82',
|
||||||
|
'margin': 'x-R4BD3S82',
|
||||||
|
'future': 'x-xcKtGhcu',
|
||||||
|
'delivery': 'x-xcKtGhcu',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
// https://binance-docs.github.io/apidocs/spot/en/#error-codes-2
|
// https://binance-docs.github.io/apidocs/spot/en/#error-codes-2
|
||||||
'exceptions': {
|
'exceptions': {
|
||||||
|
'System abnormality': ExchangeError, // {"code":-1000,"msg":"System abnormality"}
|
||||||
|
'You are not authorized to execute this request.': PermissionDenied, // {"msg":"You are not authorized to execute this request."}
|
||||||
'API key does not exist': AuthenticationError,
|
'API key does not exist': AuthenticationError,
|
||||||
'Order would trigger immediately.': OrderImmediatelyFillable,
|
'Order would trigger immediately.': OrderImmediatelyFillable,
|
||||||
|
'Stop price would trigger immediately.': OrderImmediatelyFillable, // {"code":-2010,"msg":"Stop price would trigger immediately."}
|
||||||
'Order would immediately match and take.': OrderImmediatelyFillable, // {"code":-2010,"msg":"Order would immediately match and take."}
|
'Order would immediately match and take.': OrderImmediatelyFillable, // {"code":-2010,"msg":"Order would immediately match and take."}
|
||||||
'Account has insufficient balance for requested action.': InsufficientFunds,
|
'Account has insufficient balance for requested action.': InsufficientFunds,
|
||||||
'Rest API trading is not enabled.': ExchangeNotAvailable,
|
'Rest API trading is not enabled.': ExchangeNotAvailable,
|
||||||
@@ -508,14 +558,21 @@ module.exports = class binance extends Exchange {
|
|||||||
'-2013': OrderNotFound, // fetchOrder (1, 'BTC/USDT') -> 'Order does not exist'
|
'-2013': OrderNotFound, // fetchOrder (1, 'BTC/USDT') -> 'Order does not exist'
|
||||||
'-2014': AuthenticationError, // { "code":-2014, "msg": "API-key format invalid." }
|
'-2014': AuthenticationError, // { "code":-2014, "msg": "API-key format invalid." }
|
||||||
'-2015': AuthenticationError, // "Invalid API-key, IP, or permissions for action."
|
'-2015': AuthenticationError, // "Invalid API-key, IP, or permissions for action."
|
||||||
|
'-2019': InsufficientFunds, // {"code":-2019,"msg":"Margin is insufficient."}
|
||||||
'-3005': InsufficientFunds, // {"code":-3005,"msg":"Transferring out not allowed. Transfer out amount exceeds max amount."}
|
'-3005': InsufficientFunds, // {"code":-3005,"msg":"Transferring out not allowed. Transfer out amount exceeds max amount."}
|
||||||
'-3008': InsufficientFunds, // {"code":-3008,"msg":"Borrow not allowed. Your borrow amount has exceed maximum borrow amount."}
|
'-3008': InsufficientFunds, // {"code":-3008,"msg":"Borrow not allowed. Your borrow amount has exceed maximum borrow amount."}
|
||||||
'-3010': ExchangeError, // {"code":-3010,"msg":"Repay not allowed. Repay amount exceeds borrow amount."}
|
'-3010': ExchangeError, // {"code":-3010,"msg":"Repay not allowed. Repay amount exceeds borrow amount."}
|
||||||
'-3022': AccountSuspended, // You account's trading is banned.
|
'-3022': AccountSuspended, // You account's trading is banned.
|
||||||
|
'-4028': BadRequest, // {"code":-4028,"msg":"Leverage 100 is not valid"}
|
||||||
|
'-5013': InsufficientFunds, // Asset transfer failed: insufficient balance"
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currencyToPrecision (currency, fee) {
|
||||||
|
return this.numberToString (fee);
|
||||||
|
}
|
||||||
|
|
||||||
nonce () {
|
nonce () {
|
||||||
return this.milliseconds () - this.options['timeDifference'];
|
return this.milliseconds () - this.options['timeDifference'];
|
||||||
}
|
}
|
||||||
@@ -539,6 +596,145 @@ module.exports = class binance extends Exchange {
|
|||||||
return this.options['timeDifference'];
|
return this.options['timeDifference'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fetchCurrencies (params = {}) {
|
||||||
|
const fetchCurrenciesEnabled = this.safeValue (this.options, 'fetchCurrencies');
|
||||||
|
if (!fetchCurrenciesEnabled) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
// this endpoint requires authentication
|
||||||
|
// while fetchCurrencies is a public API method by design
|
||||||
|
// therefore we check the keys here
|
||||||
|
// and fallback to generating the currencies from the markets
|
||||||
|
if (!this.checkRequiredCredentials (false)) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
// sandbox/testnet does not support sapi endpoints
|
||||||
|
const apiBackup = this.safeString (this.urls, 'apiBackup');
|
||||||
|
if (apiBackup !== undefined) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
const response = await this.sapiGetCapitalConfigGetall (params);
|
||||||
|
const result = {};
|
||||||
|
for (let i = 0; i < response.length; i++) {
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// coin: 'LINK',
|
||||||
|
// depositAllEnable: true,
|
||||||
|
// withdrawAllEnable: true,
|
||||||
|
// name: 'ChainLink',
|
||||||
|
// free: '0.06168',
|
||||||
|
// locked: '0',
|
||||||
|
// freeze: '0',
|
||||||
|
// withdrawing: '0',
|
||||||
|
// ipoing: '0',
|
||||||
|
// ipoable: '0',
|
||||||
|
// storage: '0',
|
||||||
|
// isLegalMoney: false,
|
||||||
|
// trading: true,
|
||||||
|
// networkList: [
|
||||||
|
// {
|
||||||
|
// network: 'BNB',
|
||||||
|
// coin: 'LINK',
|
||||||
|
// withdrawIntegerMultiple: '0',
|
||||||
|
// isDefault: false,
|
||||||
|
// depositEnable: true,
|
||||||
|
// withdrawEnable: true,
|
||||||
|
// depositDesc: '',
|
||||||
|
// withdrawDesc: '',
|
||||||
|
// specialTips: 'Both a MEMO and an Address are required to successfully deposit your LINK BEP2 tokens to Binance.',
|
||||||
|
// name: 'BEP2',
|
||||||
|
// resetAddressStatus: false,
|
||||||
|
// addressRegex: '^(bnb1)[0-9a-z]{38}$',
|
||||||
|
// memoRegex: '^[0-9A-Za-z\\-_]{1,120}$',
|
||||||
|
// withdrawFee: '0.002',
|
||||||
|
// withdrawMin: '0.01',
|
||||||
|
// withdrawMax: '9999999',
|
||||||
|
// minConfirm: 1,
|
||||||
|
// unLockConfirm: 0
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// network: 'BSC',
|
||||||
|
// coin: 'LINK',
|
||||||
|
// withdrawIntegerMultiple: '0.00000001',
|
||||||
|
// isDefault: false,
|
||||||
|
// depositEnable: true,
|
||||||
|
// withdrawEnable: true,
|
||||||
|
// depositDesc: '',
|
||||||
|
// withdrawDesc: '',
|
||||||
|
// specialTips: '',
|
||||||
|
// name: 'BEP20 (BSC)',
|
||||||
|
// resetAddressStatus: false,
|
||||||
|
// addressRegex: '^(0x)[0-9A-Fa-f]{40}$',
|
||||||
|
// memoRegex: '',
|
||||||
|
// withdrawFee: '0.005',
|
||||||
|
// withdrawMin: '0.01',
|
||||||
|
// withdrawMax: '9999999',
|
||||||
|
// minConfirm: 15,
|
||||||
|
// unLockConfirm: 0
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// network: 'ETH',
|
||||||
|
// coin: 'LINK',
|
||||||
|
// withdrawIntegerMultiple: '0.00000001',
|
||||||
|
// isDefault: true,
|
||||||
|
// depositEnable: true,
|
||||||
|
// withdrawEnable: true,
|
||||||
|
// depositDesc: '',
|
||||||
|
// withdrawDesc: '',
|
||||||
|
// name: 'ERC20',
|
||||||
|
// resetAddressStatus: false,
|
||||||
|
// addressRegex: '^(0x)[0-9A-Fa-f]{40}$',
|
||||||
|
// memoRegex: '',
|
||||||
|
// withdrawFee: '0.34',
|
||||||
|
// withdrawMin: '0.68',
|
||||||
|
// withdrawMax: '0',
|
||||||
|
// minConfirm: 12,
|
||||||
|
// unLockConfirm: 0
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
const entry = response[i];
|
||||||
|
const id = this.safeString (entry, 'coin');
|
||||||
|
const name = this.safeString (entry, 'name');
|
||||||
|
const code = this.safeCurrencyCode (id);
|
||||||
|
const precision = undefined;
|
||||||
|
let isWithdrawEnabled = true;
|
||||||
|
let isDepositEnabled = true;
|
||||||
|
const networkList = this.safeValue (entry, 'networkList', []);
|
||||||
|
const fees = {};
|
||||||
|
let fee = undefined;
|
||||||
|
for (let j = 0; j < networkList.length; j++) {
|
||||||
|
const networkItem = networkList[j];
|
||||||
|
const name = this.safeString (networkItem, 'name');
|
||||||
|
const withdrawFee = this.safeFloat (networkItem, 'withdrawFee');
|
||||||
|
const depositEnable = this.safeValue (networkItem, 'depositEnable');
|
||||||
|
const withdrawEnable = this.safeValue (networkItem, 'withdrawEnable');
|
||||||
|
isDepositEnabled = isDepositEnabled || depositEnable;
|
||||||
|
isWithdrawEnabled = isWithdrawEnabled || withdrawEnable;
|
||||||
|
fees[name] = withdrawFee;
|
||||||
|
const isDefault = this.safeValue (networkItem, 'isDefault');
|
||||||
|
if (isDefault || fee === undefined) {
|
||||||
|
fee = withdrawFee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const trading = this.safeValue (entry, 'trading');
|
||||||
|
const active = (isWithdrawEnabled && isDepositEnabled && trading);
|
||||||
|
result[code] = {
|
||||||
|
'id': id,
|
||||||
|
'name': name,
|
||||||
|
'code': code,
|
||||||
|
'precision': precision,
|
||||||
|
'info': entry,
|
||||||
|
'active': active,
|
||||||
|
'fee': fee,
|
||||||
|
'fees': fees,
|
||||||
|
'limits': this.limits,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
async fetchMarkets (params = {}) {
|
async fetchMarkets (params = {}) {
|
||||||
const defaultType = this.safeString2 (this.options, 'fetchMarkets', 'defaultType', 'spot');
|
const defaultType = this.safeString2 (this.options, 'fetchMarkets', 'defaultType', 'spot');
|
||||||
const type = this.safeString (params, 'type', defaultType);
|
const type = this.safeString (params, 'type', defaultType);
|
||||||
@@ -715,9 +911,8 @@ module.exports = class binance extends Exchange {
|
|||||||
const quoteId = this.safeString (market, 'quoteAsset');
|
const quoteId = this.safeString (market, 'quoteAsset');
|
||||||
const base = this.safeCurrencyCode (baseId);
|
const base = this.safeCurrencyCode (baseId);
|
||||||
const quote = this.safeCurrencyCode (quoteId);
|
const quote = this.safeCurrencyCode (quoteId);
|
||||||
const parts = id.split ('_');
|
const contractType = this.safeString (market, 'contractType');
|
||||||
const lastPart = this.safeString (parts, 1);
|
const idSymbol = (future || delivery) && (contractType !== 'PERPETUAL');
|
||||||
const idSymbol = (delivery) && (lastPart !== 'PERP');
|
|
||||||
const symbol = idSymbol ? id : (base + '/' + quote);
|
const symbol = idSymbol ? id : (base + '/' + quote);
|
||||||
const filters = this.safeValue (market, 'filters', []);
|
const filters = this.safeValue (market, 'filters', []);
|
||||||
const filtersByType = this.indexBy (filters, 'filterType');
|
const filtersByType = this.indexBy (filters, 'filterType');
|
||||||
@@ -795,7 +990,7 @@ module.exports = class binance extends Exchange {
|
|||||||
}
|
}
|
||||||
if ('MIN_NOTIONAL' in filtersByType) {
|
if ('MIN_NOTIONAL' in filtersByType) {
|
||||||
const filter = this.safeValue (filtersByType, 'MIN_NOTIONAL', {});
|
const filter = this.safeValue (filtersByType, 'MIN_NOTIONAL', {});
|
||||||
entry['limits']['cost']['min'] = this.safeFloat (filter, 'minNotional');
|
entry['limits']['cost']['min'] = this.safeFloat2 (filter, 'minNotional', 'notional');
|
||||||
}
|
}
|
||||||
result.push (entry);
|
result.push (entry);
|
||||||
}
|
}
|
||||||
@@ -1197,15 +1392,24 @@ module.exports = class binance extends Exchange {
|
|||||||
async fetchOHLCV (symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
async fetchOHLCV (symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
|
// binance docs say that the default limit 500, max 1500 for futures, max 1000 for spot markets
|
||||||
|
// the reality is that the time range wider than 500 candles won't work right
|
||||||
|
const defaultLimit = 500;
|
||||||
|
const maxLimit = 1500;
|
||||||
|
limit = (limit === undefined) ? defaultLimit : Math.min (limit, maxLimit);
|
||||||
const request = {
|
const request = {
|
||||||
'symbol': market['id'],
|
'symbol': market['id'],
|
||||||
'interval': this.timeframes[timeframe],
|
'interval': this.timeframes[timeframe],
|
||||||
|
'limit': limit,
|
||||||
};
|
};
|
||||||
|
const duration = this.parseTimeframe (timeframe);
|
||||||
if (since !== undefined) {
|
if (since !== undefined) {
|
||||||
request['startTime'] = since;
|
request['startTime'] = since;
|
||||||
}
|
if (since > 0) {
|
||||||
if (limit !== undefined) {
|
const endTime = this.sum (since, limit * duration * 1000 - 1);
|
||||||
request['limit'] = limit; // default == max == 500
|
const now = this.milliseconds ();
|
||||||
|
request['endTime'] = Math.min (now, endTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let method = 'publicGetKlines';
|
let method = 'publicGetKlines';
|
||||||
if (market['future']) {
|
if (market['future']) {
|
||||||
@@ -1293,6 +1497,23 @@ module.exports = class binance extends Exchange {
|
|||||||
// "symbol": "BTCUSDT",
|
// "symbol": "BTCUSDT",
|
||||||
// "time": 1569514978020
|
// "time": 1569514978020
|
||||||
// }
|
// }
|
||||||
|
// {
|
||||||
|
// "symbol": "BTCUSDT",
|
||||||
|
// "id": 477128891,
|
||||||
|
// "orderId": 13809777875,
|
||||||
|
// "side": "SELL",
|
||||||
|
// "price": "38479.55",
|
||||||
|
// "qty": "0.001",
|
||||||
|
// "realizedPnl": "-0.00009534",
|
||||||
|
// "marginAsset": "USDT",
|
||||||
|
// "quoteQty": "38.47955",
|
||||||
|
// "commission": "-0.00076959",
|
||||||
|
// "commissionAsset": "USDT",
|
||||||
|
// "time": 1612733566708,
|
||||||
|
// "positionSide": "BOTH",
|
||||||
|
// "maker": true,
|
||||||
|
// "buyer": false
|
||||||
|
// }
|
||||||
//
|
//
|
||||||
const timestamp = this.safeInteger2 (trade, 'T', 'time');
|
const timestamp = this.safeInteger2 (trade, 'T', 'time');
|
||||||
const price = this.safeFloat2 (trade, 'p', 'price');
|
const price = this.safeFloat2 (trade, 'p', 'price');
|
||||||
@@ -1322,6 +1543,9 @@ module.exports = class binance extends Exchange {
|
|||||||
if ('isMaker' in trade) {
|
if ('isMaker' in trade) {
|
||||||
takerOrMaker = trade['isMaker'] ? 'maker' : 'taker';
|
takerOrMaker = trade['isMaker'] ? 'maker' : 'taker';
|
||||||
}
|
}
|
||||||
|
if ('maker' in trade) {
|
||||||
|
takerOrMaker = trade['maker'] ? 'maker' : 'taker';
|
||||||
|
}
|
||||||
const marketId = this.safeString (trade, 'symbol');
|
const marketId = this.safeString (trade, 'symbol');
|
||||||
const symbol = this.safeSymbol (marketId, market);
|
const symbol = this.safeSymbol (marketId, market);
|
||||||
let cost = undefined;
|
let cost = undefined;
|
||||||
@@ -1439,7 +1663,7 @@ module.exports = class binance extends Exchange {
|
|||||||
'CANCELED': 'canceled',
|
'CANCELED': 'canceled',
|
||||||
'PENDING_CANCEL': 'canceling', // currently unused
|
'PENDING_CANCEL': 'canceling', // currently unused
|
||||||
'REJECTED': 'rejected',
|
'REJECTED': 'rejected',
|
||||||
'EXPIRED': 'canceled',
|
'EXPIRED': 'expired',
|
||||||
};
|
};
|
||||||
return this.safeString (statuses, status, status);
|
return this.safeString (statuses, status, status);
|
||||||
}
|
}
|
||||||
@@ -1565,6 +1789,8 @@ module.exports = class binance extends Exchange {
|
|||||||
}
|
}
|
||||||
const clientOrderId = this.safeString (order, 'clientOrderId');
|
const clientOrderId = this.safeString (order, 'clientOrderId');
|
||||||
const timeInForce = this.safeString (order, 'timeInForce');
|
const timeInForce = this.safeString (order, 'timeInForce');
|
||||||
|
const postOnly = (type === 'limit_maker') || (timeInForce === 'GTX');
|
||||||
|
const stopPrice = this.safeFloat (order, 'stopPrice');
|
||||||
return {
|
return {
|
||||||
'info': order,
|
'info': order,
|
||||||
'id': id,
|
'id': id,
|
||||||
@@ -1575,8 +1801,10 @@ module.exports = class binance extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': timeInForce,
|
'timeInForce': timeInForce,
|
||||||
|
'postOnly': postOnly,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
|
'stopPrice': stopPrice,
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
'cost': cost,
|
'cost': cost,
|
||||||
'average': average,
|
'average': average,
|
||||||
@@ -1621,7 +1849,15 @@ module.exports = class binance extends Exchange {
|
|||||||
'type': uppercaseType,
|
'type': uppercaseType,
|
||||||
'side': side.toUpperCase (),
|
'side': side.toUpperCase (),
|
||||||
};
|
};
|
||||||
if (clientOrderId !== undefined) {
|
if (clientOrderId === undefined) {
|
||||||
|
const broker = this.safeValue (this.options, 'broker');
|
||||||
|
if (broker) {
|
||||||
|
const brokerId = this.safeString (broker, orderType);
|
||||||
|
if (brokerId !== undefined) {
|
||||||
|
request['newClientOrderId'] = brokerId + this.uuid22 ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
request['newClientOrderId'] = clientOrderId;
|
request['newClientOrderId'] = clientOrderId;
|
||||||
}
|
}
|
||||||
if (market['spot']) {
|
if (market['spot']) {
|
||||||
@@ -1700,7 +1936,7 @@ module.exports = class binance extends Exchange {
|
|||||||
quantityIsRequired = true;
|
quantityIsRequired = true;
|
||||||
const callbackRate = this.safeFloat (params, 'callbackRate');
|
const callbackRate = this.safeFloat (params, 'callbackRate');
|
||||||
if (callbackRate === undefined) {
|
if (callbackRate === undefined) {
|
||||||
throw new InvalidOrder (this.id + ' createOrder method requires a callbackRate extra param for a ' + type + ' order');
|
throw new InvalidOrder (this.id + ' createOrder() requires a callbackRate extra param for a ' + type + ' order');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (quantityIsRequired) {
|
if (quantityIsRequired) {
|
||||||
@@ -1708,7 +1944,7 @@ module.exports = class binance extends Exchange {
|
|||||||
}
|
}
|
||||||
if (priceIsRequired) {
|
if (priceIsRequired) {
|
||||||
if (price === undefined) {
|
if (price === undefined) {
|
||||||
throw new InvalidOrder (this.id + ' createOrder method requires a price argument for a ' + type + ' order');
|
throw new InvalidOrder (this.id + ' createOrder() requires a price argument for a ' + type + ' order');
|
||||||
}
|
}
|
||||||
request['price'] = this.priceToPrecision (symbol, price);
|
request['price'] = this.priceToPrecision (symbol, price);
|
||||||
}
|
}
|
||||||
@@ -1718,7 +1954,7 @@ module.exports = class binance extends Exchange {
|
|||||||
if (stopPriceIsRequired) {
|
if (stopPriceIsRequired) {
|
||||||
const stopPrice = this.safeFloat (params, 'stopPrice');
|
const stopPrice = this.safeFloat (params, 'stopPrice');
|
||||||
if (stopPrice === undefined) {
|
if (stopPrice === undefined) {
|
||||||
throw new InvalidOrder (this.id + ' createOrder method requires a stopPrice extra param for a ' + type + ' order');
|
throw new InvalidOrder (this.id + ' createOrder() requires a stopPrice extra param for a ' + type + ' order');
|
||||||
} else {
|
} else {
|
||||||
params = this.omit (params, 'stopPrice');
|
params = this.omit (params, 'stopPrice');
|
||||||
request['stopPrice'] = this.priceToPrecision (symbol, stopPrice);
|
request['stopPrice'] = this.priceToPrecision (symbol, stopPrice);
|
||||||
@@ -1730,7 +1966,7 @@ module.exports = class binance extends Exchange {
|
|||||||
|
|
||||||
async fetchOrder (id, symbol = undefined, params = {}) {
|
async fetchOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -1751,7 +1987,7 @@ module.exports = class binance extends Exchange {
|
|||||||
if (clientOrderId !== undefined) {
|
if (clientOrderId !== undefined) {
|
||||||
request['origClientOrderId'] = clientOrderId;
|
request['origClientOrderId'] = clientOrderId;
|
||||||
} else {
|
} else {
|
||||||
request['orderId'] = parseInt (id);
|
request['orderId'] = id;
|
||||||
}
|
}
|
||||||
const query = this.omit (params, [ 'type', 'clientOrderId', 'origClientOrderId' ]);
|
const query = this.omit (params, [ 'type', 'clientOrderId', 'origClientOrderId' ]);
|
||||||
const response = await this[method] (this.extend (request, query));
|
const response = await this[method] (this.extend (request, query));
|
||||||
@@ -1760,7 +1996,7 @@ module.exports = class binance extends Exchange {
|
|||||||
|
|
||||||
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -1873,7 +2109,7 @@ module.exports = class binance extends Exchange {
|
|||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -1883,11 +2119,11 @@ module.exports = class binance extends Exchange {
|
|||||||
const origClientOrderId = this.safeValue2 (params, 'origClientOrderId', 'clientOrderId');
|
const origClientOrderId = this.safeValue2 (params, 'origClientOrderId', 'clientOrderId');
|
||||||
const request = {
|
const request = {
|
||||||
'symbol': market['id'],
|
'symbol': market['id'],
|
||||||
// 'orderId': parseInt (id),
|
// 'orderId': id,
|
||||||
// 'origClientOrderId': id,
|
// 'origClientOrderId': id,
|
||||||
};
|
};
|
||||||
if (origClientOrderId === undefined) {
|
if (origClientOrderId === undefined) {
|
||||||
request['orderId'] = parseInt (id);
|
request['orderId'] = id;
|
||||||
} else {
|
} else {
|
||||||
request['origClientOrderId'] = origClientOrderId;
|
request['origClientOrderId'] = origClientOrderId;
|
||||||
}
|
}
|
||||||
@@ -1906,7 +2142,7 @@ module.exports = class binance extends Exchange {
|
|||||||
|
|
||||||
async cancelAllOrders (symbol = undefined, params = {}) {
|
async cancelAllOrders (symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelAllOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelAllOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -1917,7 +2153,9 @@ module.exports = class binance extends Exchange {
|
|||||||
const type = this.safeString (params, 'type', defaultType);
|
const type = this.safeString (params, 'type', defaultType);
|
||||||
const query = this.omit (params, 'type');
|
const query = this.omit (params, 'type');
|
||||||
let method = 'privateDeleteOpenOrders';
|
let method = 'privateDeleteOpenOrders';
|
||||||
if (type === 'future') {
|
if (type === 'margin') {
|
||||||
|
method = 'sapiDeleteMarginOpenOrders';
|
||||||
|
} else if (type === 'future') {
|
||||||
method = 'fapiPrivateDeleteAllOpenOrders';
|
method = 'fapiPrivateDeleteAllOpenOrders';
|
||||||
} else if (type === 'delivery') {
|
} else if (type === 'delivery') {
|
||||||
method = 'dapiPrivateDeleteAllOpenOrders';
|
method = 'dapiPrivateDeleteAllOpenOrders';
|
||||||
@@ -1983,20 +2221,23 @@ module.exports = class binance extends Exchange {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
const type = this.safeValue (params, 'type', market['type']);
|
const defaultType = this.safeString2 (this.options, 'fetchMyTrades', 'defaultType', market['type']);
|
||||||
|
const type = this.safeString (params, 'type', defaultType);
|
||||||
|
params = this.omit (params, 'type');
|
||||||
let method = undefined;
|
let method = undefined;
|
||||||
if (type === 'spot') {
|
if (type === 'spot') {
|
||||||
method = 'privateGetMyTrades';
|
method = 'privateGetMyTrades';
|
||||||
|
} else if (type === 'margin') {
|
||||||
|
method = 'sapiGetMarginMyTrades';
|
||||||
} else if (type === 'future') {
|
} else if (type === 'future') {
|
||||||
method = 'fapiPrivateGetUserTrades';
|
method = 'fapiPrivateGetUserTrades';
|
||||||
} else if (type === 'delivery') {
|
} else if (type === 'delivery') {
|
||||||
method = 'dapiPrivateGetUserTrades';
|
method = 'dapiPrivateGetUserTrades';
|
||||||
}
|
}
|
||||||
params = this.omit (params, 'type');
|
|
||||||
const request = {
|
const request = {
|
||||||
'symbol': market['id'],
|
'symbol': market['id'],
|
||||||
};
|
};
|
||||||
@@ -2280,7 +2521,10 @@ module.exports = class binance extends Exchange {
|
|||||||
tag = undefined;
|
tag = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const txid = this.safeString (transaction, 'txId');
|
let txid = this.safeString (transaction, 'txId');
|
||||||
|
if ((txid !== undefined) && (txid.indexOf ('Internal transfer ') >= 0)) {
|
||||||
|
txid = txid.slice (18);
|
||||||
|
}
|
||||||
const currencyId = this.safeString (transaction, 'asset');
|
const currencyId = this.safeString (transaction, 'asset');
|
||||||
const code = this.safeCurrencyCode (currencyId, currency);
|
const code = this.safeCurrencyCode (currencyId, currency);
|
||||||
let timestamp = undefined;
|
let timestamp = undefined;
|
||||||
@@ -2329,15 +2573,27 @@ module.exports = class binance extends Exchange {
|
|||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const currency = this.currency (code);
|
const currency = this.currency (code);
|
||||||
const request = {
|
const request = {
|
||||||
'asset': currency['id'],
|
'coin': currency['id'],
|
||||||
|
// 'network': 'ETH', // 'BSC', 'XMR', you can get network and isDefault in networkList in the response of sapiGetCapitalConfigDetail
|
||||||
};
|
};
|
||||||
const response = await this.wapiGetDepositAddress (this.extend (request, params));
|
// has support for the 'network' parameter
|
||||||
const success = this.safeValue (response, 'success');
|
// https://binance-docs.github.io/apidocs/spot/en/#deposit-address-supporting-network-user_data
|
||||||
if ((success === undefined) || !success) {
|
const response = await this.sapiGetCapitalDepositAddress (this.extend (request, params));
|
||||||
throw new InvalidAddress (this.id + ' fetchDepositAddress returned an empty response – create the deposit address in the user settings first.');
|
//
|
||||||
}
|
// {
|
||||||
|
// currency: 'XRP',
|
||||||
|
// address: 'rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh',
|
||||||
|
// tag: '108618262',
|
||||||
|
// info: {
|
||||||
|
// coin: 'XRP',
|
||||||
|
// address: 'rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh',
|
||||||
|
// tag: '108618262',
|
||||||
|
// url: 'https://bithomp.com/explorer/rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh'
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
const address = this.safeString (response, 'address');
|
const address = this.safeString (response, 'address');
|
||||||
const tag = this.safeString (response, 'addressTag');
|
const tag = this.safeString (response, 'tag');
|
||||||
this.checkAddress (address);
|
this.checkAddress (address);
|
||||||
return {
|
return {
|
||||||
'currency': code,
|
'currency': code,
|
||||||
@@ -2515,7 +2771,7 @@ module.exports = class binance extends Exchange {
|
|||||||
'timestamp': this.nonce (),
|
'timestamp': this.nonce (),
|
||||||
'recvWindow': recvWindow,
|
'recvWindow': recvWindow,
|
||||||
}, params));
|
}, params));
|
||||||
} else if (path === 'batchOrders') {
|
} else if ((path === 'batchOrders') || (path.indexOf ('sub-account') >= 0)) {
|
||||||
query = this.rawencode (this.extend ({
|
query = this.rawencode (this.extend ({
|
||||||
'timestamp': this.nonce (),
|
'timestamp': this.nonce (),
|
||||||
'recvWindow': recvWindow,
|
'recvWindow': recvWindow,
|
||||||
|
|||||||
Generated
Vendored
+4
@@ -42,5 +42,9 @@ module.exports = class binanceus extends binance {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fetchCurrencies (params = {}) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Generated
Vendored
+1
@@ -306,6 +306,7 @@ module.exports = class bit2c extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': undefined,
|
'type': undefined,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+7
-3
@@ -82,6 +82,8 @@ module.exports = class bitbank extends Exchange {
|
|||||||
'BCH/JPY': { 'id': 'bcc_jpy', 'symbol': 'BCH/JPY', 'base': 'BCH', 'quote': 'JPY', 'baseId': 'bcc', 'quoteId': 'jpy' },
|
'BCH/JPY': { 'id': 'bcc_jpy', 'symbol': 'BCH/JPY', 'base': 'BCH', 'quote': 'JPY', 'baseId': 'bcc', 'quoteId': 'jpy' },
|
||||||
'MONA/BTC': { 'id': 'mona_btc', 'symbol': 'MONA/BTC', 'base': 'MONA', 'quote': 'BTC', 'baseId': 'mona', 'quoteId': 'btc' },
|
'MONA/BTC': { 'id': 'mona_btc', 'symbol': 'MONA/BTC', 'base': 'MONA', 'quote': 'BTC', 'baseId': 'mona', 'quoteId': 'btc' },
|
||||||
'MONA/JPY': { 'id': 'mona_jpy', 'symbol': 'MONA/JPY', 'base': 'MONA', 'quote': 'JPY', 'baseId': 'mona', 'quoteId': 'jpy' },
|
'MONA/JPY': { 'id': 'mona_jpy', 'symbol': 'MONA/JPY', 'base': 'MONA', 'quote': 'JPY', 'baseId': 'mona', 'quoteId': 'jpy' },
|
||||||
|
'QTUM/BTC': { 'id': 'qtum_btc', 'symbol': 'QTUM/BTC', 'base': 'QTUM', 'quote': 'BTC', 'baseId': 'qtum', 'quoteId': 'btc' },
|
||||||
|
'QTUM/JPY': { 'id': 'qtum_jpy', 'symbol': 'QTUM/JPY', 'base': 'QTUM', 'quote': 'JPY', 'baseId': 'qtum', 'quoteId': 'jpy' },
|
||||||
'ETH/BTC': { 'id': 'eth_btc', 'symbol': 'ETH/BTC', 'base': 'ETH', 'quote': 'BTC', 'baseId': 'eth', 'quoteId': 'btc' },
|
'ETH/BTC': { 'id': 'eth_btc', 'symbol': 'ETH/BTC', 'base': 'ETH', 'quote': 'BTC', 'baseId': 'eth', 'quoteId': 'btc' },
|
||||||
'LTC/BTC': { 'id': 'ltc_btc', 'symbol': 'LTC/BTC', 'base': 'LTC', 'quote': 'BTC', 'baseId': 'ltc', 'quoteId': 'btc' },
|
'LTC/BTC': { 'id': 'ltc_btc', 'symbol': 'LTC/BTC', 'base': 'LTC', 'quote': 'BTC', 'baseId': 'ltc', 'quoteId': 'btc' },
|
||||||
'XRP/JPY': { 'id': 'xrp_jpy', 'symbol': 'XRP/JPY', 'base': 'XRP', 'quote': 'JPY', 'baseId': 'xrp', 'quoteId': 'jpy' },
|
'XRP/JPY': { 'id': 'xrp_jpy', 'symbol': 'XRP/JPY', 'base': 'XRP', 'quote': 'JPY', 'baseId': 'xrp', 'quoteId': 'jpy' },
|
||||||
@@ -90,6 +92,7 @@ module.exports = class bitbank extends Exchange {
|
|||||||
'ETH/JPY': { 'id': 'eth_jpy', 'symbol': 'ETH/JPY', 'base': 'ETH', 'quote': 'JPY', 'baseId': 'eth', 'quoteId': 'jpy' },
|
'ETH/JPY': { 'id': 'eth_jpy', 'symbol': 'ETH/JPY', 'base': 'ETH', 'quote': 'JPY', 'baseId': 'eth', 'quoteId': 'jpy' },
|
||||||
'LTC/JPY': { 'id': 'ltc_jpy', 'symbol': 'LTC/JPY', 'base': 'LTC', 'quote': 'JPY', 'baseId': 'ltc', 'quoteId': 'jpy' },
|
'LTC/JPY': { 'id': 'ltc_jpy', 'symbol': 'LTC/JPY', 'base': 'LTC', 'quote': 'JPY', 'baseId': 'ltc', 'quoteId': 'jpy' },
|
||||||
'XRP/BTC': { 'id': 'xrp_btc', 'symbol': 'XRP/BTC', 'base': 'XRP', 'quote': 'BTC', 'baseId': 'xrp', 'quoteId': 'btc' },
|
'XRP/BTC': { 'id': 'xrp_btc', 'symbol': 'XRP/BTC', 'base': 'XRP', 'quote': 'BTC', 'baseId': 'xrp', 'quoteId': 'btc' },
|
||||||
|
'XLM/BTC': { 'id': 'xlm_btc', 'symbol': 'XLM/BTC', 'base': 'XLM', 'quote': 'BTC', 'baseId': 'xlm', 'quoteId': 'btc' },
|
||||||
},
|
},
|
||||||
'fees': {
|
'fees': {
|
||||||
'trading': {
|
'trading': {
|
||||||
@@ -207,8 +210,8 @@ module.exports = class bitbank extends Exchange {
|
|||||||
const feeCost = this.safeFloat (trade, 'fee_amount_quote');
|
const feeCost = this.safeFloat (trade, 'fee_amount_quote');
|
||||||
if (feeCost !== undefined) {
|
if (feeCost !== undefined) {
|
||||||
fee = {
|
fee = {
|
||||||
'currency': market['quote'],
|
'currency': feeCurrency,
|
||||||
'cost': feeCurrency,
|
'cost': feeCost,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const orderId = this.safeString (trade, 'order_id');
|
const orderId = this.safeString (trade, 'order_id');
|
||||||
@@ -367,6 +370,7 @@ module.exports = class bitbank extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -385,7 +389,7 @@ module.exports = class bitbank extends Exchange {
|
|||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
if (price === undefined) {
|
if (price === undefined) {
|
||||||
throw new InvalidOrder (this.id + ' createOrder requires a price argument for both market and limit orders');
|
throw new InvalidOrder (this.id + ' createOrder() requires a price argument for both market and limit orders');
|
||||||
}
|
}
|
||||||
const request = {
|
const request = {
|
||||||
'pair': market['id'],
|
'pair': market['id'],
|
||||||
|
|||||||
Generated
Vendored
+2
@@ -351,6 +351,7 @@ module.exports = class bitbay extends Exchange {
|
|||||||
filled = Math.max (0, amount - remaining);
|
filled = Math.max (0, amount - remaining);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const postOnly = this.safeValue (order, 'postOnly');
|
||||||
return {
|
return {
|
||||||
'id': this.safeString (order, 'id'),
|
'id': this.safeString (order, 'id'),
|
||||||
'clientOrderId': undefined,
|
'clientOrderId': undefined,
|
||||||
@@ -362,6 +363,7 @@ module.exports = class bitbay extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': this.safeString (order, 'mode'),
|
'type': this.safeString (order, 'mode'),
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': postOnly,
|
||||||
'side': this.safeStringLower (order, 'offerType'),
|
'side': this.safeStringLower (order, 'offerType'),
|
||||||
'price': this.safeFloat (order, 'rate'),
|
'price': this.safeFloat (order, 'rate'),
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+23
-3
@@ -16,7 +16,6 @@ module.exports = class bitfinex extends Exchange {
|
|||||||
'countries': [ 'VG' ],
|
'countries': [ 'VG' ],
|
||||||
'version': 'v1',
|
'version': 'v1',
|
||||||
'rateLimit': 1500,
|
'rateLimit': 1500,
|
||||||
'certified': true,
|
|
||||||
'pro': true,
|
'pro': true,
|
||||||
// new metainfo interface
|
// new metainfo interface
|
||||||
'has': {
|
'has': {
|
||||||
@@ -54,6 +53,7 @@ module.exports = class bitfinex extends Exchange {
|
|||||||
'30m': '30m',
|
'30m': '30m',
|
||||||
'1h': '1h',
|
'1h': '1h',
|
||||||
'3h': '3h',
|
'3h': '3h',
|
||||||
|
'4h': '4h',
|
||||||
'6h': '6h',
|
'6h': '6h',
|
||||||
'12h': '12h',
|
'12h': '12h',
|
||||||
'1d': '1D',
|
'1d': '1D',
|
||||||
@@ -600,13 +600,32 @@ module.exports = class bitfinex extends Exchange {
|
|||||||
|
|
||||||
async fetchBalance (params = {}) {
|
async fetchBalance (params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
|
const types = {
|
||||||
|
'exchange': 'exchange',
|
||||||
|
'deposit': 'funding',
|
||||||
|
'trading': 'margin',
|
||||||
|
};
|
||||||
const balanceType = this.safeString (params, 'type', 'exchange');
|
const balanceType = this.safeString (params, 'type', 'exchange');
|
||||||
const query = this.omit (params, 'type');
|
const query = this.omit (params, 'type');
|
||||||
const response = await this.privatePostBalances (query);
|
const response = await this.privatePostBalances (query);
|
||||||
|
// [ { type: 'deposit',
|
||||||
|
// currency: 'btc',
|
||||||
|
// amount: '0.00116721',
|
||||||
|
// available: '0.00116721' },
|
||||||
|
// { type: 'exchange',
|
||||||
|
// currency: 'ust',
|
||||||
|
// amount: '0.0000002',
|
||||||
|
// available: '0.0000002' },
|
||||||
|
// { type: 'trading',
|
||||||
|
// currency: 'btc',
|
||||||
|
// amount: '0.0005',
|
||||||
|
// available: '0.0005' } ],
|
||||||
const result = { 'info': response };
|
const result = { 'info': response };
|
||||||
for (let i = 0; i < response.length; i++) {
|
for (let i = 0; i < response.length; i++) {
|
||||||
const balance = response[i];
|
const balance = response[i];
|
||||||
if (balance['type'] === balanceType) {
|
const type = this.safeString (balance, 'type');
|
||||||
|
const parsedType = this.safeString (types, type);
|
||||||
|
if ((parsedType === balanceType) || (type === balanceType)) {
|
||||||
const currencyId = this.safeString (balance, 'currency');
|
const currencyId = this.safeString (balance, 'currency');
|
||||||
const code = this.safeCurrencyCode (currencyId);
|
const code = this.safeCurrencyCode (currencyId);
|
||||||
// bitfinex had BCH previously, now it's BAB, but the old
|
// bitfinex had BCH previously, now it's BAB, but the old
|
||||||
@@ -769,7 +788,7 @@ module.exports = class bitfinex extends Exchange {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a `symbol` argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a `symbol` argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -887,6 +906,7 @@ module.exports = class bitfinex extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': orderType,
|
'type': orderType,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': this.safeFloat (order, 'price'),
|
'price': this.safeFloat (order, 'price'),
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+38
-3
@@ -3,7 +3,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const bitfinex = require ('./bitfinex.js');
|
const bitfinex = require ('./bitfinex.js');
|
||||||
const { ExchangeError, InvalidAddress, ArgumentsRequired, InsufficientFunds, AuthenticationError, OrderNotFound, InvalidOrder, BadRequest, InvalidNonce, BadSymbol, OnMaintenance } = require ('./base/errors');
|
const { ExchangeError, InvalidAddress, ArgumentsRequired, InsufficientFunds, AuthenticationError, OrderNotFound, InvalidOrder, BadRequest, InvalidNonce, BadSymbol, OnMaintenance, NotSupported } = require ('./base/errors');
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -53,6 +53,7 @@ module.exports = class bitfinex2 extends bitfinex {
|
|||||||
'30m': '30m',
|
'30m': '30m',
|
||||||
'1h': '1h',
|
'1h': '1h',
|
||||||
'3h': '3h',
|
'3h': '3h',
|
||||||
|
'4h': '4h',
|
||||||
'6h': '6h',
|
'6h': '6h',
|
||||||
'12h': '12h',
|
'12h': '12h',
|
||||||
'1d': '1D',
|
'1d': '1D',
|
||||||
@@ -171,7 +172,9 @@ module.exports = class bitfinex2 extends bitfinex {
|
|||||||
'auth/w/position/claim',
|
'auth/w/position/claim',
|
||||||
'auth/r/positions/hist',
|
'auth/r/positions/hist',
|
||||||
'auth/r/positions/audit',
|
'auth/r/positions/audit',
|
||||||
|
'auth/r/positions/snap',
|
||||||
'auth/w/deriv/collateral/set',
|
'auth/w/deriv/collateral/set',
|
||||||
|
'auth/w/deriv/collateral/limits',
|
||||||
'auth/r/funding/offers',
|
'auth/r/funding/offers',
|
||||||
'auth/r/funding/offers/{symbol}',
|
'auth/r/funding/offers/{symbol}',
|
||||||
'auth/w/funding/offer/submit',
|
'auth/w/funding/offer/submit',
|
||||||
@@ -583,6 +586,10 @@ module.exports = class bitfinex2 extends bitfinex {
|
|||||||
return this.parseBalance (result);
|
return this.parseBalance (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fetchOrder (id, symbol = undefined, params = {}) {
|
||||||
|
throw new NotSupported (this.id + ' fetchOrder is not implemented yet');
|
||||||
|
}
|
||||||
|
|
||||||
async fetchOrderBook (symbol, limit = undefined, params = {}) {
|
async fetchOrderBook (symbol, limit = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const precision = this.safeValue (this.options, 'precision', 'R0');
|
const precision = this.safeValue (this.options, 'precision', 'R0');
|
||||||
@@ -923,6 +930,7 @@ module.exports = class bitfinex2 extends bitfinex {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -941,16 +949,43 @@ module.exports = class bitfinex2 extends bitfinex {
|
|||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
const orderTypes = this.safeValue (this.options, 'orderTypes', {});
|
const orderTypes = this.safeValue (this.options, 'orderTypes', {});
|
||||||
const orderType = this.safeString (orderTypes, type, type);
|
const orderType = this.safeStringUpper (orderTypes, type, type);
|
||||||
amount = (side === 'sell') ? -amount : amount;
|
amount = (side === 'sell') ? -amount : amount;
|
||||||
const request = {
|
const request = {
|
||||||
'symbol': market['id'],
|
'symbol': market['id'],
|
||||||
'type': orderType,
|
'type': orderType,
|
||||||
'amount': this.numberToString (amount),
|
'amount': this.numberToString (amount),
|
||||||
};
|
};
|
||||||
if (type !== 'market') {
|
if ((orderType === 'LIMIT') || (orderType === 'EXCHANGE LIMIT')) {
|
||||||
|
request['price'] = this.numberToString (price);
|
||||||
|
} else if ((orderType === 'STOP') || (orderType === 'EXCHANGE STOP')) {
|
||||||
|
const stopPrice = this.safeFloat (params, 'stopPrice', price);
|
||||||
|
request['price'] = this.numberToString (stopPrice);
|
||||||
|
} else if ((orderType === 'STOP LIMIT') || (orderType === 'EXCHANGE STOP LIMIT')) {
|
||||||
|
const priceAuxLimit = this.safeFloat (params, 'price_aux_limit');
|
||||||
|
let stopPrice = this.safeFloat (params, 'stopPrice');
|
||||||
|
if (priceAuxLimit === undefined) {
|
||||||
|
if (stopPrice === undefined) {
|
||||||
|
throw new ArgumentsRequired (this.id + ' createOrder() requires a stopPrice parameter or a price_aux_limit parameter for a ' + orderType + ' order');
|
||||||
|
} else {
|
||||||
|
request['price_aux_limit'] = this.numberToString (price);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
request['price_aux_limit'] = this.numberToString (priceAuxLimit);
|
||||||
|
if (stopPrice === undefined) {
|
||||||
|
stopPrice = price;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
request['price'] = this.numberToString (stopPrice);
|
||||||
|
} else if ((orderType === 'TRAILING STOP') || (orderType === 'EXCHANGE TRAILING STOP')) {
|
||||||
|
const priceTrailing = this.safeFloat (params, 'price_trailing');
|
||||||
|
request['price_trailing'] = this.numberToString (priceTrailing);
|
||||||
|
const stopPrice = this.safeFloat (params, 'stopPrice', price);
|
||||||
|
request['price'] = this.numberToString (stopPrice);
|
||||||
|
} else if ((orderType === 'FOK') || (orderType === 'EXCHANGE FOK') || (orderType === 'IOC') || (orderType === 'EXCHANGE IOC')) {
|
||||||
request['price'] = this.numberToString (price);
|
request['price'] = this.numberToString (price);
|
||||||
}
|
}
|
||||||
|
params = this.omit (params, [ 'stopPrice', 'price_aux_limit', 'price_trailing' ]);
|
||||||
const clientOrderId = this.safeValue2 (params, 'cid', 'clientOrderId');
|
const clientOrderId = this.safeValue2 (params, 'cid', 'clientOrderId');
|
||||||
if (clientOrderId !== undefined) {
|
if (clientOrderId !== undefined) {
|
||||||
request['cid'] = clientOrderId;
|
request['cid'] = clientOrderId;
|
||||||
|
|||||||
Generated
Vendored
+3
-2
@@ -365,6 +365,7 @@ module.exports = class bitflyer extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -424,7 +425,7 @@ module.exports = class bitflyer extends Exchange {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a `symbol` argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a `symbol` argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -440,7 +441,7 @@ module.exports = class bitflyer extends Exchange {
|
|||||||
|
|
||||||
async fetchPositions (symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchPositions (symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbols === undefined) {
|
if (symbols === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchPositions requires a `symbols` argument, exactly one symbol in an array');
|
throw new ArgumentsRequired (this.id + ' fetchPositions() requires a `symbols` argument, exactly one symbol in an array');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {
|
const request = {
|
||||||
|
|||||||
Generated
Vendored
+4
-1
@@ -3,7 +3,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const Exchange = require ('./base/Exchange');
|
const Exchange = require ('./base/Exchange');
|
||||||
const { ExchangeError, AuthenticationError, OrderNotFound, InsufficientFunds, DDoSProtection, PermissionDenied } = require ('./base/errors');
|
const { ExchangeError, AuthenticationError, OrderNotFound, InsufficientFunds, DDoSProtection, PermissionDenied, BadSymbol } = require ('./base/errors');
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -223,6 +223,7 @@ module.exports = class bitforex extends Exchange {
|
|||||||
},
|
},
|
||||||
'commonCurrencies': {
|
'commonCurrencies': {
|
||||||
'CREDIT': 'TerraCredit',
|
'CREDIT': 'TerraCredit',
|
||||||
|
'HBC': 'Hybrid Bank Cash',
|
||||||
'IQ': 'IQ.Cash',
|
'IQ': 'IQ.Cash',
|
||||||
'UOS': 'UOS Network',
|
'UOS': 'UOS Network',
|
||||||
},
|
},
|
||||||
@@ -231,6 +232,7 @@ module.exports = class bitforex extends Exchange {
|
|||||||
'1013': AuthenticationError,
|
'1013': AuthenticationError,
|
||||||
'1016': AuthenticationError,
|
'1016': AuthenticationError,
|
||||||
'1017': PermissionDenied, // {"code":"1017","success":false,"time":1602670594367,"message":"IP not allow"}
|
'1017': PermissionDenied, // {"code":"1017","success":false,"time":1602670594367,"message":"IP not allow"}
|
||||||
|
'1019': BadSymbol, // {"code":"1019","success":false,"time":1607087743778,"message":"Symbol Invalid"}
|
||||||
'3002': InsufficientFunds,
|
'3002': InsufficientFunds,
|
||||||
'10204': DDoSProtection,
|
'10204': DDoSProtection,
|
||||||
},
|
},
|
||||||
@@ -499,6 +501,7 @@ module.exports = class bitforex extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+19
-17
@@ -1704,7 +1704,7 @@ module.exports = class bitget extends Exchange {
|
|||||||
const type = this.safeString (params, 'type', defaultType);
|
const type = this.safeString (params, 'type', defaultType);
|
||||||
params = this.omit (params, 'type');
|
params = this.omit (params, 'type');
|
||||||
if (type === undefined) {
|
if (type === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + " requires an 'accountId' parameter");
|
throw new ArgumentsRequired (this.id + " getAccountId() requires an 'accountId' parameter");
|
||||||
}
|
}
|
||||||
const account = await this.findAccountByType (type);
|
const account = await this.findAccountByType (type);
|
||||||
return account['id'];
|
return account['id'];
|
||||||
@@ -1716,7 +1716,7 @@ module.exports = class bitget extends Exchange {
|
|||||||
const defaultType = this.safeString2 (this.options, 'fetchBalance', 'defaultType');
|
const defaultType = this.safeString2 (this.options, 'fetchBalance', 'defaultType');
|
||||||
const type = this.safeString (params, 'type', defaultType);
|
const type = this.safeString (params, 'type', defaultType);
|
||||||
if (type === undefined) {
|
if (type === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + " fetchBalance requires a 'type' parameter, one of 'spot', 'swap'");
|
throw new ArgumentsRequired (this.id + " fetchBalance() requires a 'type' parameter, one of 'spot', 'swap'");
|
||||||
}
|
}
|
||||||
let method = undefined;
|
let method = undefined;
|
||||||
const query = this.omit (params, 'type');
|
const query = this.omit (params, 'type');
|
||||||
@@ -1960,6 +1960,7 @@ module.exports = class bitget extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -2042,7 +2043,7 @@ module.exports = class bitget extends Exchange {
|
|||||||
request['client_oid'] = clientOrderId;
|
request['client_oid'] = clientOrderId;
|
||||||
const orderType = this.safeString (params, 'type');
|
const orderType = this.safeString (params, 'type');
|
||||||
if (orderType === undefined) {
|
if (orderType === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + " createOrder requires a type parameter, '1' = open long, '2' = open short, '3' = close long, '4' = close short for " + market['type'] + ' orders');
|
throw new ArgumentsRequired (this.id + " createOrder() requires a type parameter, '1' = open long, '2' = open short, '3' = close long, '4' = close short for " + market['type'] + ' orders');
|
||||||
}
|
}
|
||||||
request['size'] = this.amountToPrecision (symbol, amount);
|
request['size'] = this.amountToPrecision (symbol, amount);
|
||||||
request['type'] = orderType;
|
request['type'] = orderType;
|
||||||
@@ -2084,7 +2085,7 @@ module.exports = class bitget extends Exchange {
|
|||||||
const type = this.safeString (params, 'type', defaultType);
|
const type = this.safeString (params, 'type', defaultType);
|
||||||
if (type === 'spot') {
|
if (type === 'spot') {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires a symbol argument for spot orders');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a symbol argument for spot orders');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2125,14 +2126,15 @@ module.exports = class bitget extends Exchange {
|
|||||||
|
|
||||||
async cancelOrders (ids, symbol = undefined, params = {}) {
|
async cancelOrders (ids, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
const type = this.safeString (params, 'type', market['type']);
|
const type = this.safeString (params, 'type', market['type']);
|
||||||
if (type === undefined) {
|
if (type === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + " cancelOrders requires a type parameter (one of 'spot', 'swap').");
|
throw new ArgumentsRequired (this.id + " cancelOrders() requires a type parameter (one of 'spot', 'swap').");
|
||||||
}
|
}
|
||||||
|
params = this.omit (params, 'type');
|
||||||
const request = {};
|
const request = {};
|
||||||
let method = undefined;
|
let method = undefined;
|
||||||
if (type === 'spot') {
|
if (type === 'spot') {
|
||||||
@@ -2189,13 +2191,13 @@ module.exports = class bitget extends Exchange {
|
|||||||
|
|
||||||
async fetchOrder (id, symbol = undefined, params = {}) {
|
async fetchOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
const type = this.safeString (params, 'type', market['type']);
|
const type = this.safeString (params, 'type', market['type']);
|
||||||
if (type === undefined) {
|
if (type === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + " fetchOrder requires a type parameter (one of 'spot', 'swap').");
|
throw new ArgumentsRequired (this.id + " fetchOrder() requires a type parameter (one of 'spot', 'swap').");
|
||||||
}
|
}
|
||||||
let method = undefined;
|
let method = undefined;
|
||||||
const request = {};
|
const request = {};
|
||||||
@@ -2266,7 +2268,7 @@ module.exports = class bitget extends Exchange {
|
|||||||
|
|
||||||
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOpenOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOpenOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -2351,7 +2353,7 @@ module.exports = class bitget extends Exchange {
|
|||||||
|
|
||||||
async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchClosedOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchClosedOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -2443,7 +2445,7 @@ module.exports = class bitget extends Exchange {
|
|||||||
|
|
||||||
async fetchDeposits (code = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchDeposits (code = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (code === undefined) {
|
if (code === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchDeposits requires a currency code argument');
|
throw new ArgumentsRequired (this.id + ' fetchDeposits() requires a currency code argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const currency = this.currency (code);
|
const currency = this.currency (code);
|
||||||
@@ -2480,7 +2482,7 @@ module.exports = class bitget extends Exchange {
|
|||||||
|
|
||||||
async fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (code === undefined) {
|
if (code === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchWithdrawals requires a currency code argument');
|
throw new ArgumentsRequired (this.id + ' fetchWithdrawals() requires a currency code argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const currency = this.currency (code);
|
const currency = this.currency (code);
|
||||||
@@ -2603,14 +2605,14 @@ module.exports = class bitget extends Exchange {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
const type = this.safeString (params, 'type', market['type']);
|
const type = this.safeString (params, 'type', market['type']);
|
||||||
const query = this.omit (params, 'type');
|
const query = this.omit (params, 'type');
|
||||||
if (type === 'swap') {
|
if (type === 'swap') {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades is not supported for ' + type + ' type');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() is not supported for ' + type + ' type');
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// spot
|
// spot
|
||||||
@@ -2667,12 +2669,12 @@ module.exports = class bitget extends Exchange {
|
|||||||
|
|
||||||
async fetchOrderTrades (id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOrderTrades (id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrderTrades requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrderTrades() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
const type = this.safeString (params, 'type', market['type']);
|
const type = this.safeString (params, 'type', market['type']);
|
||||||
const query = this.omit (params, 'type');
|
params = this.omit (params, 'type');
|
||||||
let method = undefined;
|
let method = undefined;
|
||||||
const request = {};
|
const request = {};
|
||||||
if (type === 'spot') {
|
if (type === 'spot') {
|
||||||
@@ -2684,7 +2686,7 @@ module.exports = class bitget extends Exchange {
|
|||||||
request['symbol'] = market['id'];
|
request['symbol'] = market['id'];
|
||||||
method = 'swapGetOrderFills';
|
method = 'swapGetOrderFills';
|
||||||
}
|
}
|
||||||
const response = await this[method] (this.extend (request, query));
|
const response = await this[method] (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// spot
|
// spot
|
||||||
//
|
//
|
||||||
|
|||||||
Generated
Vendored
+141
-52
@@ -22,6 +22,7 @@ module.exports = class bithumb extends Exchange {
|
|||||||
'createOrder': true,
|
'createOrder': true,
|
||||||
'fetchBalance': true,
|
'fetchBalance': true,
|
||||||
'fetchMarkets': true,
|
'fetchMarkets': true,
|
||||||
|
'fetchOHLCV': true,
|
||||||
'fetchOpenOrders': true,
|
'fetchOpenOrders': true,
|
||||||
'fetchOrder': true,
|
'fetchOrder': true,
|
||||||
'fetchOrderBook': true,
|
'fetchOrderBook': true,
|
||||||
@@ -45,10 +46,13 @@ module.exports = class bithumb extends Exchange {
|
|||||||
'get': [
|
'get': [
|
||||||
'ticker/{currency}',
|
'ticker/{currency}',
|
||||||
'ticker/all',
|
'ticker/all',
|
||||||
|
'ticker/ALL_BTC',
|
||||||
|
'ticker/ALL_KRW',
|
||||||
'orderbook/{currency}',
|
'orderbook/{currency}',
|
||||||
'orderbook/all',
|
'orderbook/all',
|
||||||
'transaction_history/{currency}',
|
'transaction_history/{currency}',
|
||||||
'transaction_history/all',
|
'transaction_history/all',
|
||||||
|
'candlestick/{currency}/{interval}',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'private': {
|
'private': {
|
||||||
@@ -92,6 +96,27 @@ module.exports = class bithumb extends Exchange {
|
|||||||
'Unknown Error': ExchangeError,
|
'Unknown Error': ExchangeError,
|
||||||
'After May 23th, recent_transactions is no longer, hence users will not be able to connect to recent_transactions': ExchangeError, // {"status":"5100","message":"After May 23th, recent_transactions is no longer, hence users will not be able to connect to recent_transactions"}
|
'After May 23th, recent_transactions is no longer, hence users will not be able to connect to recent_transactions': ExchangeError, // {"status":"5100","message":"After May 23th, recent_transactions is no longer, hence users will not be able to connect to recent_transactions"}
|
||||||
},
|
},
|
||||||
|
'timeframes': {
|
||||||
|
'1m': '1m',
|
||||||
|
'3m': '3m',
|
||||||
|
'5m': '5m',
|
||||||
|
'10m': '10m',
|
||||||
|
'30m': '30m',
|
||||||
|
'1h': '1h',
|
||||||
|
'6h': '6h',
|
||||||
|
'12h': '12h',
|
||||||
|
'1d': '24h',
|
||||||
|
},
|
||||||
|
'options': {
|
||||||
|
'quoteCurrencies': {
|
||||||
|
'BTC': {
|
||||||
|
'precision': {
|
||||||
|
'price': 8,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'KRW': {},
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,54 +125,61 @@ module.exports = class bithumb extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchMarkets (params = {}) {
|
async fetchMarkets (params = {}) {
|
||||||
const response = await this.publicGetTickerAll (params);
|
|
||||||
const data = this.safeValue (response, 'data');
|
|
||||||
const currencyIds = Object.keys (data);
|
|
||||||
const result = [];
|
const result = [];
|
||||||
const quote = this.safeCurrencyCode ('KRW');
|
const quoteCurrencies = this.safeValue (this.options, 'quoteCurrencies', {});
|
||||||
for (let i = 0; i < currencyIds.length; i++) {
|
const quotes = Object.keys (quoteCurrencies);
|
||||||
const currencyId = currencyIds[i];
|
for (let i = 0; i < quotes.length; i++) {
|
||||||
if (currencyId === 'date') {
|
const quote = quotes[i];
|
||||||
continue;
|
const extension = this.safeValue (quoteCurrencies, quote, {});
|
||||||
}
|
const method = 'publicGetTickerALL' + quote;
|
||||||
const market = data[currencyId];
|
const response = await this[method] (params);
|
||||||
const base = this.safeCurrencyCode (currencyId);
|
const data = this.safeValue (response, 'data');
|
||||||
const symbol = currencyId + '/' + quote;
|
const currencyIds = Object.keys (data);
|
||||||
let active = true;
|
for (let j = 0; j < currencyIds.length; j++) {
|
||||||
if (Array.isArray (market)) {
|
const currencyId = currencyIds[j];
|
||||||
const numElements = market.length;
|
if (currencyId === 'date') {
|
||||||
if (numElements === 0) {
|
continue;
|
||||||
active = false;
|
|
||||||
}
|
}
|
||||||
|
const market = data[currencyId];
|
||||||
|
const base = this.safeCurrencyCode (currencyId);
|
||||||
|
const symbol = currencyId + '/' + quote;
|
||||||
|
let active = true;
|
||||||
|
if (Array.isArray (market)) {
|
||||||
|
const numElements = market.length;
|
||||||
|
if (numElements === 0) {
|
||||||
|
active = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const entry = this.deepExtend ({
|
||||||
|
'id': currencyId,
|
||||||
|
'symbol': symbol,
|
||||||
|
'base': base,
|
||||||
|
'quote': quote,
|
||||||
|
'info': market,
|
||||||
|
'active': active,
|
||||||
|
'precision': {
|
||||||
|
'amount': 4,
|
||||||
|
'price': 4,
|
||||||
|
},
|
||||||
|
'limits': {
|
||||||
|
'amount': {
|
||||||
|
'min': undefined,
|
||||||
|
'max': undefined,
|
||||||
|
},
|
||||||
|
'price': {
|
||||||
|
'min': undefined,
|
||||||
|
'max': undefined,
|
||||||
|
},
|
||||||
|
'cost': {
|
||||||
|
'min': 500,
|
||||||
|
'max': 5000000000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'baseId': undefined,
|
||||||
|
'quoteId': undefined,
|
||||||
|
}, extension);
|
||||||
|
result.push (entry);
|
||||||
}
|
}
|
||||||
result.push ({
|
|
||||||
'id': currencyId,
|
|
||||||
'symbol': symbol,
|
|
||||||
'base': base,
|
|
||||||
'quote': quote,
|
|
||||||
'info': market,
|
|
||||||
'active': active,
|
|
||||||
'precision': {
|
|
||||||
'amount': 4,
|
|
||||||
'price': 4,
|
|
||||||
},
|
|
||||||
'limits': {
|
|
||||||
'amount': {
|
|
||||||
'min': undefined,
|
|
||||||
'max': undefined,
|
|
||||||
},
|
|
||||||
'price': {
|
|
||||||
'min': undefined,
|
|
||||||
'max': undefined,
|
|
||||||
},
|
|
||||||
'cost': {
|
|
||||||
'min': 500,
|
|
||||||
'max': 5000000000,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'baseId': undefined,
|
|
||||||
'quoteId': undefined,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -349,6 +381,62 @@ module.exports = class bithumb extends Exchange {
|
|||||||
return this.parseTicker (data, market);
|
return this.parseTicker (data, market);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parseOHLCV (ohlcv, market = undefined) {
|
||||||
|
//
|
||||||
|
// [
|
||||||
|
// 1576823400000, // 기준 시간
|
||||||
|
// '8284000', // 시가
|
||||||
|
// '8286000', // 종가
|
||||||
|
// '8289000', // 고가
|
||||||
|
// '8276000', // 저가
|
||||||
|
// '15.41503692' // 거래량
|
||||||
|
// ]
|
||||||
|
//
|
||||||
|
return [
|
||||||
|
this.safeInteger (ohlcv, 0),
|
||||||
|
this.safeFloat (ohlcv, 1),
|
||||||
|
this.safeFloat (ohlcv, 3),
|
||||||
|
this.safeFloat (ohlcv, 4),
|
||||||
|
this.safeFloat (ohlcv, 2),
|
||||||
|
this.safeFloat (ohlcv, 5),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchOHLCV (symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
||||||
|
await this.loadMarkets ();
|
||||||
|
const market = this.market (symbol);
|
||||||
|
const request = {
|
||||||
|
'currency': market['base'],
|
||||||
|
'interval': this.timeframes[timeframe],
|
||||||
|
};
|
||||||
|
const response = await this.publicGetCandlestickCurrencyInterval (this.extend (request, params));
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// 'status': '0000',
|
||||||
|
// 'data': {
|
||||||
|
// [
|
||||||
|
// 1576823400000, // 기준 시간
|
||||||
|
// '8284000', // 시가
|
||||||
|
// '8286000', // 종가
|
||||||
|
// '8289000', // 고가
|
||||||
|
// '8276000', // 저가
|
||||||
|
// '15.41503692' // 거래량
|
||||||
|
// ],
|
||||||
|
// [
|
||||||
|
// 1576824000000, // 기준 시간
|
||||||
|
// '8284000', // 시가
|
||||||
|
// '8281000', // 종가
|
||||||
|
// '8289000', // 고가
|
||||||
|
// '8275000', // 저가
|
||||||
|
// '6.19584467' // 거래량
|
||||||
|
// ],
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
const data = this.safeValue (response, 'data', []);
|
||||||
|
return this.parseOHLCVs (data, market, timeframe, since, limit);
|
||||||
|
}
|
||||||
|
|
||||||
parseTrade (trade, market = undefined) {
|
parseTrade (trade, market = undefined) {
|
||||||
//
|
//
|
||||||
// fetchTrades (public)
|
// fetchTrades (public)
|
||||||
@@ -470,7 +558,7 @@ module.exports = class bithumb extends Exchange {
|
|||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
const request = {
|
const request = {
|
||||||
'order_currency': market['id'],
|
'order_currency': market['id'],
|
||||||
'Payment_currency': market['quote'],
|
'payment_currency': market['quote'],
|
||||||
'units': amount,
|
'units': amount,
|
||||||
};
|
};
|
||||||
let method = 'privatePostTradePlace';
|
let method = 'privatePostTradePlace';
|
||||||
@@ -483,7 +571,7 @@ module.exports = class bithumb extends Exchange {
|
|||||||
const response = await this[method] (this.extend (request, params));
|
const response = await this[method] (this.extend (request, params));
|
||||||
const id = this.safeString (response, 'order_id');
|
const id = this.safeString (response, 'order_id');
|
||||||
if (id === undefined) {
|
if (id === undefined) {
|
||||||
throw new InvalidOrder (this.id + ' createOrder did not return an order id');
|
throw new InvalidOrder (this.id + ' createOrder() did not return an order id');
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
'info': response,
|
'info': response,
|
||||||
@@ -496,7 +584,7 @@ module.exports = class bithumb extends Exchange {
|
|||||||
|
|
||||||
async fetchOrder (id, symbol = undefined, params = {}) {
|
async fetchOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -708,6 +796,7 @@ module.exports = class bithumb extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -730,7 +819,7 @@ module.exports = class bithumb extends Exchange {
|
|||||||
|
|
||||||
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOpenOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOpenOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -770,10 +859,10 @@ module.exports = class bithumb extends Exchange {
|
|||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
const side_in_params = ('side' in params);
|
const side_in_params = ('side' in params);
|
||||||
if (!side_in_params) {
|
if (!side_in_params) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires a `symbol` argument and a `side` parameter (sell or buy)');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a `symbol` argument and a `side` parameter (sell or buy)');
|
||||||
}
|
}
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires a `symbol` argument and a `side` parameter (sell or buy)');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a `symbol` argument and a `side` parameter (sell or buy)');
|
||||||
}
|
}
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
const side = (params['side'] === 'buy') ? 'bid' : 'ask';
|
const side = (params['side'] === 'buy') ? 'bid' : 'ask';
|
||||||
@@ -804,7 +893,7 @@ module.exports = class bithumb extends Exchange {
|
|||||||
'address': address,
|
'address': address,
|
||||||
'currency': currency['id'],
|
'currency': currency['id'],
|
||||||
};
|
};
|
||||||
if (currency === 'XRP' || currency === 'XMR') {
|
if (currency === 'XRP' || currency === 'XMR' || currency === 'EOS' || currency === 'STEEM') {
|
||||||
const destination = this.safeString (params, 'destination');
|
const destination = this.safeString (params, 'destination');
|
||||||
if ((tag === undefined) && (destination === undefined)) {
|
if ((tag === undefined) && (destination === undefined)) {
|
||||||
throw new ArgumentsRequired (this.id + ' ' + code + ' withdraw() requires a tag argument or an extra destination param');
|
throw new ArgumentsRequired (this.id + ' ' + code + ' withdraw() requires a tag argument or an extra destination param');
|
||||||
|
|||||||
Generated
Vendored
+3
@@ -21,6 +21,9 @@ module.exports = class bitkk extends zb {
|
|||||||
'doc': 'https://www.bitkk.com/i/developer',
|
'doc': 'https://www.bitkk.com/i/developer',
|
||||||
'fees': 'https://www.bitkk.com/i/rate',
|
'fees': 'https://www.bitkk.com/i/rate',
|
||||||
},
|
},
|
||||||
|
'commonCurrencies': {
|
||||||
|
'BCH': 'BCHOLD',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Generated
Vendored
+33
-18
@@ -48,7 +48,7 @@ module.exports = class bitmart extends Exchange {
|
|||||||
'logo': 'https://user-images.githubusercontent.com/1294454/61835713-a2662f80-ae85-11e9-9d00-6442919701fd.jpg',
|
'logo': 'https://user-images.githubusercontent.com/1294454/61835713-a2662f80-ae85-11e9-9d00-6442919701fd.jpg',
|
||||||
'api': 'https://api-cloud.{hostname}', // bitmart.info for Hong Kong users
|
'api': 'https://api-cloud.{hostname}', // bitmart.info for Hong Kong users
|
||||||
'www': 'https://www.bitmart.com/',
|
'www': 'https://www.bitmart.com/',
|
||||||
'doc': 'https://github.com/bitmartexchange/bitmart-official-api-docs',
|
'doc': 'https://developer-pro.bitmart.com/',
|
||||||
'referral': 'http://www.bitmart.com/?r=rQCFLh',
|
'referral': 'http://www.bitmart.com/?r=rQCFLh',
|
||||||
'fees': 'https://www.bitmart.com/fee/en',
|
'fees': 'https://www.bitmart.com/fee/en',
|
||||||
},
|
},
|
||||||
@@ -161,8 +161,8 @@ module.exports = class bitmart extends Exchange {
|
|||||||
'trading': {
|
'trading': {
|
||||||
'tierBased': true,
|
'tierBased': true,
|
||||||
'percentage': true,
|
'percentage': true,
|
||||||
'taker': 0.002,
|
'taker': 0.0025,
|
||||||
'maker': 0.001,
|
'maker': 0.0025,
|
||||||
'tiers': {
|
'tiers': {
|
||||||
'taker': [
|
'taker': [
|
||||||
[0, 0.20 / 100],
|
[0, 0.20 / 100],
|
||||||
@@ -296,6 +296,8 @@ module.exports = class bitmart extends Exchange {
|
|||||||
'broad': {},
|
'broad': {},
|
||||||
},
|
},
|
||||||
'commonCurrencies': {
|
'commonCurrencies': {
|
||||||
|
'COT': 'Community Coin',
|
||||||
|
'CPC': 'CPCoin',
|
||||||
'ONE': 'Menlo One',
|
'ONE': 'Menlo One',
|
||||||
'PLA': 'Plair',
|
'PLA': 'Plair',
|
||||||
},
|
},
|
||||||
@@ -1241,7 +1243,7 @@ module.exports = class bitmart extends Exchange {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -1249,7 +1251,7 @@ module.exports = class bitmart extends Exchange {
|
|||||||
const request = {};
|
const request = {};
|
||||||
if (market['spot']) {
|
if (market['spot']) {
|
||||||
request['symbol'] = market['id'];
|
request['symbol'] = market['id'];
|
||||||
request['offset'] = 1;
|
request['offset'] = 1; // max offset * limit < 500
|
||||||
if (limit === undefined) {
|
if (limit === undefined) {
|
||||||
limit = 100; // max 100
|
limit = 100; // max 100
|
||||||
}
|
}
|
||||||
@@ -1322,7 +1324,7 @@ module.exports = class bitmart extends Exchange {
|
|||||||
|
|
||||||
async fetchOrderTrades (id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOrderTrades (id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrderTrades requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrderTrades() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -1600,6 +1602,7 @@ module.exports = class bitmart extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -1705,7 +1708,7 @@ module.exports = class bitmart extends Exchange {
|
|||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -1733,6 +1736,15 @@ module.exports = class bitmart extends Exchange {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
// spot alternative
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "code": 1000,
|
||||||
|
// "trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1",
|
||||||
|
// "message": "OK",
|
||||||
|
// "data": true
|
||||||
|
// }
|
||||||
|
//
|
||||||
// contract
|
// contract
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
@@ -1748,16 +1760,19 @@ module.exports = class bitmart extends Exchange {
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
const data = this.safeValue (response, 'data');
|
const data = this.safeValue (response, 'data');
|
||||||
|
if (data === true) {
|
||||||
|
return this.parseOrder (id, market);
|
||||||
|
}
|
||||||
const succeeded = this.safeValue (data, 'succeed');
|
const succeeded = this.safeValue (data, 'succeed');
|
||||||
if (succeeded !== undefined) {
|
if (succeeded !== undefined) {
|
||||||
id = this.safeString (succeeded, 0);
|
id = this.safeString (succeeded, 0);
|
||||||
if (id === undefined) {
|
if (id === undefined) {
|
||||||
throw new InvalidOrder (this.id + ' cancelOrder failed to cancel ' + symbol + ' order id ' + id);
|
throw new InvalidOrder (this.id + ' cancelOrder() failed to cancel ' + symbol + ' order id ' + id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const result = this.safeValue (data, 'result');
|
const result = this.safeValue (data, 'result');
|
||||||
if (!result) {
|
if (!result) {
|
||||||
throw new InvalidOrder (this.id + ' cancelOrder ' + symbol + ' order id ' + id + ' is filled or canceled');
|
throw new InvalidOrder (this.id + ' cancelOrder() ' + symbol + ' order id ' + id + ' is filled or canceled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const order = this.parseOrder (id, market);
|
const order = this.parseOrder (id, market);
|
||||||
@@ -1766,16 +1781,16 @@ module.exports = class bitmart extends Exchange {
|
|||||||
|
|
||||||
async cancelAllOrders (symbol = undefined, params = {}) {
|
async cancelAllOrders (symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelAllOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelAllOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
const side = this.safeString (params, 'side');
|
const side = this.safeString (params, 'side');
|
||||||
if (side === undefined) {
|
if (side === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + " cancelAllOrders requires a `side` parameter ('buy' or 'sell')");
|
throw new ArgumentsRequired (this.id + " cancelAllOrders() requires a `side` parameter ('buy' or 'sell')");
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
if (!market['spot']) {
|
if (!market['spot']) {
|
||||||
throw new NotSupported (this.id + ' cancelAllOrders does not support ' + market['type'] + ' orders, only spot orders are accepted');
|
throw new NotSupported (this.id + ' cancelAllOrders() does not support ' + market['type'] + ' orders, only spot orders are accepted');
|
||||||
}
|
}
|
||||||
const request = {
|
const request = {
|
||||||
'symbol': market['id'],
|
'symbol': market['id'],
|
||||||
@@ -1795,12 +1810,12 @@ module.exports = class bitmart extends Exchange {
|
|||||||
|
|
||||||
async cancelOrders (ids, symbol = undefined, params = {}) {
|
async cancelOrders (ids, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' canelOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' canelOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
if (!market['spot']) {
|
if (!market['spot']) {
|
||||||
throw new NotSupported (this.id + ' cancelOrders does not support ' + market['type'] + ' orders, only contract orders are accepted');
|
throw new NotSupported (this.id + ' cancelOrders() does not support ' + market['type'] + ' orders, only contract orders are accepted');
|
||||||
}
|
}
|
||||||
const orders = [];
|
const orders = [];
|
||||||
for (let i = 0; i < ids.length; i++) {
|
for (let i = 0; i < ids.length; i++) {
|
||||||
@@ -1841,7 +1856,7 @@ module.exports = class bitmart extends Exchange {
|
|||||||
|
|
||||||
async fetchOrdersByStatus (status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOrdersByStatus (status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrdersByStatus requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrdersByStatus() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -1963,7 +1978,7 @@ module.exports = class bitmart extends Exchange {
|
|||||||
|
|
||||||
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -1975,7 +1990,7 @@ module.exports = class bitmart extends Exchange {
|
|||||||
|
|
||||||
async fetchOrder (id, symbol = undefined, params = {}) {
|
async fetchOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {};
|
const request = {};
|
||||||
@@ -2053,7 +2068,7 @@ module.exports = class bitmart extends Exchange {
|
|||||||
const orders = this.safeValue (data, 'orders', []);
|
const orders = this.safeValue (data, 'orders', []);
|
||||||
const firstOrder = this.safeValue (orders, 0);
|
const firstOrder = this.safeValue (orders, 0);
|
||||||
if (firstOrder === undefined) {
|
if (firstOrder === undefined) {
|
||||||
throw new OrderNotFound (this.id + ' fetchOrder could not find ' + symbol + ' order id ' + id);
|
throw new OrderNotFound (this.id + ' fetchOrder() could not find ' + symbol + ' order id ' + id);
|
||||||
}
|
}
|
||||||
return this.parseOrder (firstOrder, market);
|
return this.parseOrder (firstOrder, market);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Generated
Vendored
+5
-4
@@ -133,8 +133,8 @@ module.exports = class bitmax extends Exchange {
|
|||||||
'trading': {
|
'trading': {
|
||||||
'tierBased': true,
|
'tierBased': true,
|
||||||
'percentage': true,
|
'percentage': true,
|
||||||
'taker': 0.001,
|
'taker': 0.002,
|
||||||
'maker': 0.001,
|
'maker': 0.002,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'precisionMode': TICK_SIZE,
|
'precisionMode': TICK_SIZE,
|
||||||
@@ -1039,6 +1039,7 @@ module.exports = class bitmax extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': stopPrice,
|
'stopPrice': stopPrice,
|
||||||
@@ -1089,7 +1090,7 @@ module.exports = class bitmax extends Exchange {
|
|||||||
if ((type === 'stop_limit') || (type === 'stop_market')) {
|
if ((type === 'stop_limit') || (type === 'stop_market')) {
|
||||||
const stopPrice = this.safeFloat (params, 'stopPrice');
|
const stopPrice = this.safeFloat (params, 'stopPrice');
|
||||||
if (stopPrice === undefined) {
|
if (stopPrice === undefined) {
|
||||||
throw new InvalidOrder (this.id + ' createOrder requires a stopPrice parameter for ' + type + ' orders');
|
throw new InvalidOrder (this.id + ' createOrder() requires a stopPrice parameter for ' + type + ' orders');
|
||||||
} else {
|
} else {
|
||||||
request['stopPrice'] = this.priceToPrecision (symbol, stopPrice);
|
request['stopPrice'] = this.priceToPrecision (symbol, stopPrice);
|
||||||
params = this.omit (params, 'stopPrice');
|
params = this.omit (params, 'stopPrice');
|
||||||
@@ -1344,7 +1345,7 @@ module.exports = class bitmax extends Exchange {
|
|||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
await this.loadAccounts ();
|
await this.loadAccounts ();
|
||||||
|
|||||||
Generated
Vendored
+52
-8
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
const Exchange = require ('./base/Exchange');
|
const Exchange = require ('./base/Exchange');
|
||||||
const { TICK_SIZE } = require ('./base/functions/number');
|
const { TICK_SIZE } = require ('./base/functions/number');
|
||||||
const { AuthenticationError, BadRequest, DDoSProtection, ExchangeError, ExchangeNotAvailable, InsufficientFunds, InvalidOrder, OrderNotFound, PermissionDenied } = require ('./base/errors');
|
const { AuthenticationError, BadRequest, DDoSProtection, ExchangeError, ExchangeNotAvailable, InsufficientFunds, InvalidOrder, OrderNotFound, PermissionDenied, ArgumentsRequired } = require ('./base/errors');
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -167,6 +167,7 @@ module.exports = class bitmex extends Exchange {
|
|||||||
'Account has insufficient Available Balance': InsufficientFunds,
|
'Account has insufficient Available Balance': InsufficientFunds,
|
||||||
'Service unavailable': ExchangeNotAvailable, // {"error":{"message":"Service unavailable","name":"HTTPError"}}
|
'Service unavailable': ExchangeNotAvailable, // {"error":{"message":"Service unavailable","name":"HTTPError"}}
|
||||||
'Server Error': ExchangeError, // {"error":{"message":"Server Error","name":"HTTPError"}}
|
'Server Error': ExchangeError, // {"error":{"message":"Server Error","name":"HTTPError"}}
|
||||||
|
'Unable to cancel order due to existing state': InvalidOrder,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'precisionMode': TICK_SIZE,
|
'precisionMode': TICK_SIZE,
|
||||||
@@ -1219,6 +1220,43 @@ module.exports = class bitmex extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parseOrder (order, market = undefined) {
|
parseOrder (order, market = undefined) {
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "orderID":"56222c7a-9956-413a-82cf-99f4812c214b",
|
||||||
|
// "clOrdID":"",
|
||||||
|
// "clOrdLinkID":"",
|
||||||
|
// "account":1455728,
|
||||||
|
// "symbol":"XBTUSD",
|
||||||
|
// "side":"Sell",
|
||||||
|
// "simpleOrderQty":null,
|
||||||
|
// "orderQty":1,
|
||||||
|
// "price":40000,
|
||||||
|
// "displayQty":null,
|
||||||
|
// "stopPx":null,
|
||||||
|
// "pegOffsetValue":null,
|
||||||
|
// "pegPriceType":"",
|
||||||
|
// "currency":"USD",
|
||||||
|
// "settlCurrency":"XBt",
|
||||||
|
// "ordType":"Limit",
|
||||||
|
// "timeInForce":"GoodTillCancel",
|
||||||
|
// "execInst":"",
|
||||||
|
// "contingencyType":"",
|
||||||
|
// "exDestination":"XBME",
|
||||||
|
// "ordStatus":"New",
|
||||||
|
// "triggered":"",
|
||||||
|
// "workingIndicator":true,
|
||||||
|
// "ordRejReason":"",
|
||||||
|
// "simpleLeavesQty":null,
|
||||||
|
// "leavesQty":1,
|
||||||
|
// "simpleCumQty":null,
|
||||||
|
// "cumQty":0,
|
||||||
|
// "avgPx":null,
|
||||||
|
// "multiLegReportingType":"SingleSecurity",
|
||||||
|
// "text":"Submitted via API.",
|
||||||
|
// "transactTime":"2021-01-02T21:38:49.246Z",
|
||||||
|
// "timestamp":"2021-01-02T21:38:49.246Z"
|
||||||
|
// }
|
||||||
|
//
|
||||||
const status = this.parseOrderStatus (this.safeString (order, 'ordStatus'));
|
const status = this.parseOrderStatus (this.safeString (order, 'ordStatus'));
|
||||||
const marketId = this.safeString (order, 'symbol');
|
const marketId = this.safeString (order, 'symbol');
|
||||||
const symbol = this.safeSymbol (marketId, market);
|
const symbol = this.safeSymbol (marketId, market);
|
||||||
@@ -1248,6 +1286,8 @@ module.exports = class bitmex extends Exchange {
|
|||||||
const clientOrderId = this.safeString (order, 'clOrdID');
|
const clientOrderId = this.safeString (order, 'clOrdID');
|
||||||
const timeInForce = this.parseTimeInForce (this.safeString (order, 'timeInForce'));
|
const timeInForce = this.parseTimeInForce (this.safeString (order, 'timeInForce'));
|
||||||
const stopPrice = this.safeFloat (order, 'stopPx');
|
const stopPrice = this.safeFloat (order, 'stopPx');
|
||||||
|
const execInst = this.safeString (order, 'execInst');
|
||||||
|
const postOnly = (execInst === 'ParticipateDoNotInitiate');
|
||||||
return {
|
return {
|
||||||
'info': order,
|
'info': order,
|
||||||
'id': id,
|
'id': id,
|
||||||
@@ -1258,6 +1298,7 @@ module.exports = class bitmex extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': timeInForce,
|
'timeInForce': timeInForce,
|
||||||
|
'postOnly': postOnly,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': stopPrice,
|
'stopPrice': stopPrice,
|
||||||
@@ -1326,18 +1367,21 @@ module.exports = class bitmex extends Exchange {
|
|||||||
const request = {
|
const request = {
|
||||||
'symbol': market['id'],
|
'symbol': market['id'],
|
||||||
'side': this.capitalize (side),
|
'side': this.capitalize (side),
|
||||||
'orderQty': amount,
|
'orderQty': parseFloat (this.amountToPrecision (symbol, amount)),
|
||||||
'ordType': orderType,
|
'ordType': orderType,
|
||||||
};
|
};
|
||||||
if (price !== undefined) {
|
if ((orderType === 'Stop') || (orderType === 'StopLimit') || (orderType === 'MarketIfTouched') || (orderType === 'LimitIfTouched')) {
|
||||||
if (orderType === 'Stop') {
|
const stopPrice = this.safeFloat2 (params, 'stopPx', 'stopPrice');
|
||||||
const stopPrice = this.safeFloat2 (params, 'stopPx', 'stopPrice');
|
if (stopPrice === undefined) {
|
||||||
request['stopPx'] = stopPrice;
|
throw new ArgumentsRequired (this.id + ' createOrder() requires a stopPx or stopPrice parameter for the ' + orderType + ' order type');
|
||||||
params = this.omit (params, [ 'stopPx', 'stopPrice' ]);
|
|
||||||
} else {
|
} else {
|
||||||
request['price'] = price;
|
request['stopPx'] = parseFloat (this.priceToPrecision (symbol, stopPrice));
|
||||||
|
params = this.omit (params, [ 'stopPx', 'stopPrice' ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((orderType === 'Limit') || (orderType === 'StopLimit') || (orderType === 'LimitIfTouched')) {
|
||||||
|
request['price'] = parseFloat (this.priceToPrecision (symbol, price));
|
||||||
|
}
|
||||||
const clientOrderId = this.safeString2 (params, 'clOrdID', 'clientOrderId');
|
const clientOrderId = this.safeString2 (params, 'clOrdID', 'clientOrderId');
|
||||||
if (clientOrderId !== undefined) {
|
if (clientOrderId !== undefined) {
|
||||||
request['clOrdID'] = clientOrderId;
|
request['clOrdID'] = clientOrderId;
|
||||||
|
|||||||
Generated
Vendored
+11
-6
@@ -790,7 +790,10 @@ module.exports = class bitpanda extends Exchange {
|
|||||||
//
|
//
|
||||||
const feeInfo = this.safeValue (trade, 'fee', {});
|
const feeInfo = this.safeValue (trade, 'fee', {});
|
||||||
trade = this.safeValue (trade, 'trade', trade);
|
trade = this.safeValue (trade, 'trade', trade);
|
||||||
const timestamp = this.parse8601 (this.safeString (trade, 'time'));
|
let timestamp = this.safeInteger (trade, 'trade_timestamp');
|
||||||
|
if (timestamp === undefined) {
|
||||||
|
timestamp = this.parse8601 (this.safeString (trade, 'time'));
|
||||||
|
}
|
||||||
const side = this.safeStringLower2 (trade, 'side', 'taker_side');
|
const side = this.safeStringLower2 (trade, 'side', 'taker_side');
|
||||||
const price = this.safeFloat (trade, 'price');
|
const price = this.safeFloat (trade, 'price');
|
||||||
const amount = this.safeFloat (trade, 'amount');
|
const amount = this.safeFloat (trade, 'amount');
|
||||||
@@ -965,7 +968,7 @@ module.exports = class bitpanda extends Exchange {
|
|||||||
if (since !== undefined) {
|
if (since !== undefined) {
|
||||||
const to = this.safeString (params, 'to');
|
const to = this.safeString (params, 'to');
|
||||||
if (to === undefined) {
|
if (to === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchDeposits requires a "to" iso8601 string param with the since argument is specified');
|
throw new ArgumentsRequired (this.id + ' fetchDeposits() requires a "to" iso8601 string param with the since argument is specified');
|
||||||
}
|
}
|
||||||
request['from'] = this.iso8601 (since);
|
request['from'] = this.iso8601 (since);
|
||||||
}
|
}
|
||||||
@@ -1020,7 +1023,7 @@ module.exports = class bitpanda extends Exchange {
|
|||||||
if (since !== undefined) {
|
if (since !== undefined) {
|
||||||
const to = this.safeString (params, 'to');
|
const to = this.safeString (params, 'to');
|
||||||
if (to === undefined) {
|
if (to === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchWithdrawals requires a "to" iso8601 string param with the since argument is specified');
|
throw new ArgumentsRequired (this.id + ' fetchWithdrawals() requires a "to" iso8601 string param with the since argument is specified');
|
||||||
}
|
}
|
||||||
request['from'] = this.iso8601 (since);
|
request['from'] = this.iso8601 (since);
|
||||||
}
|
}
|
||||||
@@ -1325,6 +1328,7 @@ module.exports = class bitpanda extends Exchange {
|
|||||||
}
|
}
|
||||||
const timeInForce = this.parseTimeInForce (this.safeString (order, 'time_in_force'));
|
const timeInForce = this.parseTimeInForce (this.safeString (order, 'time_in_force'));
|
||||||
const stopPrice = this.safeFloat (order, 'trigger_price');
|
const stopPrice = this.safeFloat (order, 'trigger_price');
|
||||||
|
const postOnly = this.safeValue (order, 'is_post_only');
|
||||||
const result = {
|
const result = {
|
||||||
'id': id,
|
'id': id,
|
||||||
'clientOrderId': clientOrderId,
|
'clientOrderId': clientOrderId,
|
||||||
@@ -1335,6 +1339,7 @@ module.exports = class bitpanda extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': timeInForce,
|
'timeInForce': timeInForce,
|
||||||
|
'postOnly': postOnly,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': stopPrice,
|
'stopPrice': stopPrice,
|
||||||
@@ -1409,7 +1414,7 @@ module.exports = class bitpanda extends Exchange {
|
|||||||
if (uppercaseType === 'STOP') {
|
if (uppercaseType === 'STOP') {
|
||||||
const triggerPrice = this.safeFloat (params, 'trigger_price');
|
const triggerPrice = this.safeFloat (params, 'trigger_price');
|
||||||
if (triggerPrice === undefined) {
|
if (triggerPrice === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' createOrder requires a trigger_price param for ' + type + ' orders');
|
throw new ArgumentsRequired (this.id + ' createOrder() requires a trigger_price param for ' + type + ' orders');
|
||||||
}
|
}
|
||||||
request['trigger_price'] = this.priceToPrecision (symbol, triggerPrice);
|
request['trigger_price'] = this.priceToPrecision (symbol, triggerPrice);
|
||||||
params = this.omit (params, 'trigger_price');
|
params = this.omit (params, 'trigger_price');
|
||||||
@@ -1560,7 +1565,7 @@ module.exports = class bitpanda extends Exchange {
|
|||||||
if (since !== undefined) {
|
if (since !== undefined) {
|
||||||
const to = this.safeString (params, 'to');
|
const to = this.safeString (params, 'to');
|
||||||
if (to === undefined) {
|
if (to === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrders requires a "to" iso8601 string param with the since argument is specified, max range is 100 days');
|
throw new ArgumentsRequired (this.id + ' fetchOrders() requires a "to" iso8601 string param with the since argument is specified, max range is 100 days');
|
||||||
}
|
}
|
||||||
request['from'] = this.iso8601 (since);
|
request['from'] = this.iso8601 (since);
|
||||||
}
|
}
|
||||||
@@ -1724,7 +1729,7 @@ module.exports = class bitpanda extends Exchange {
|
|||||||
if (since !== undefined) {
|
if (since !== undefined) {
|
||||||
const to = this.safeString (params, 'to');
|
const to = this.safeString (params, 'to');
|
||||||
if (to === undefined) {
|
if (to === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a "to" iso8601 string param with the since argument is specified, max range is 100 days');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a "to" iso8601 string param with the since argument is specified, max range is 100 days');
|
||||||
}
|
}
|
||||||
request['from'] = this.iso8601 (since);
|
request['from'] = this.iso8601 (since);
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
Vendored
+13
-10
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
const Exchange = require ('./base/Exchange');
|
const Exchange = require ('./base/Exchange');
|
||||||
const { ExchangeError, InvalidNonce, AuthenticationError, OrderNotFound } = require ('./base/errors');
|
const { ExchangeError, InvalidNonce, AuthenticationError, OrderNotFound } = require ('./base/errors');
|
||||||
const { TICK_SIZE } = require ('./base/functions/number');
|
const { TICK_SIZE, ROUND } = require ('./base/functions/number');
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -181,23 +181,25 @@ module.exports = class bitso extends Exchange {
|
|||||||
const taker = this.safeFloat (flatRate, 'taker');
|
const taker = this.safeFloat (flatRate, 'taker');
|
||||||
const feeTiers = this.safeValue (fees, 'structure', []);
|
const feeTiers = this.safeValue (fees, 'structure', []);
|
||||||
const fee = {
|
const fee = {
|
||||||
'maker': maker,
|
'taker': parseFloat (this.decimalToPrecision (taker / 100, ROUND, 0.00000001, TICK_SIZE)),
|
||||||
'taker': taker,
|
'maker': parseFloat (this.decimalToPrecision (maker / 100, ROUND, 0.00000001, TICK_SIZE)),
|
||||||
'percentage': true,
|
'percentage': true,
|
||||||
'tierBased': true,
|
'tierBased': true,
|
||||||
};
|
};
|
||||||
const takerFees = [];
|
const takerFees = [];
|
||||||
const makerFees = [];
|
const makerFees = [];
|
||||||
for (let i = 0; i < feeTiers.length; i++) {
|
for (let j = 0; j < feeTiers.length; j++) {
|
||||||
const tier = feeTiers[i];
|
const tier = feeTiers[j];
|
||||||
const volume = this.safeFloat (tier, 'volume');
|
const volume = this.safeFloat (tier, 'volume');
|
||||||
const takerFee = this.safeFloat (tier, 'taker');
|
const takerFee = this.safeFloat (tier, 'taker');
|
||||||
const makerFee = this.safeFloat (tier, 'maker');
|
const makerFee = this.safeFloat (tier, 'maker');
|
||||||
takerFees.push ([ volume, takerFee ]);
|
const takerFeeToPrecision = parseFloat (this.decimalToPrecision (takerFee / 100, ROUND, 0.00000001, TICK_SIZE));
|
||||||
makerFees.push ([ volume, makerFee ]);
|
const makerFeeToPrecision = parseFloat (this.decimalToPrecision (makerFee / 100, ROUND, 0.00000001, TICK_SIZE));
|
||||||
if (i === 0) {
|
takerFees.push ([ volume, takerFeeToPrecision ]);
|
||||||
fee['taker'] = taker;
|
makerFees.push ([ volume, makerFeeToPrecision ]);
|
||||||
fee['maker'] = maker;
|
if (j === 0) {
|
||||||
|
fee['taker'] = parseFloat (this.decimalToPrecision (taker / 100, ROUND, 0.00000001, TICK_SIZE));
|
||||||
|
fee['maker'] = parseFloat (this.decimalToPrecision (maker / 100, ROUND, 0.00000001, TICK_SIZE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const tiers = {
|
const tiers = {
|
||||||
@@ -434,6 +436,7 @@ module.exports = class bitso extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': orderType,
|
'type': orderType,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+6
-4
@@ -3,7 +3,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const Exchange = require ('./base/Exchange');
|
const Exchange = require ('./base/Exchange');
|
||||||
const { AuthenticationError, ExchangeError, NotSupported, PermissionDenied, InvalidNonce, OrderNotFound, InsufficientFunds, InvalidAddress, InvalidOrder, ArgumentsRequired, OnMaintenance } = require ('./base/errors');
|
const { AuthenticationError, ExchangeError, NotSupported, PermissionDenied, InvalidNonce, OrderNotFound, InsufficientFunds, InvalidAddress, InvalidOrder, ArgumentsRequired, OnMaintenance, ExchangeNotAvailable } = require ('./base/errors');
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -223,6 +223,7 @@ module.exports = class bitstamp extends Exchange {
|
|||||||
'Order not found': OrderNotFound,
|
'Order not found': OrderNotFound,
|
||||||
'Price is more than 20% below market price.': InvalidOrder,
|
'Price is more than 20% below market price.': InvalidOrder,
|
||||||
'Bitstamp.net is under scheduled maintenance.': OnMaintenance, // { "error": "Bitstamp.net is under scheduled maintenance. We'll be back soon." }
|
'Bitstamp.net is under scheduled maintenance.': OnMaintenance, // { "error": "Bitstamp.net is under scheduled maintenance. We'll be back soon." }
|
||||||
|
'Order could not be placed.': ExchangeNotAvailable, // Order could not be placed (perhaps due to internal error or trade halt). Please retry placing order.
|
||||||
},
|
},
|
||||||
'broad': {
|
'broad': {
|
||||||
'Minimum order size is': InvalidOrder, // Minimum order size is 5.0 EUR.
|
'Minimum order size is': InvalidOrder, // Minimum order size is 5.0 EUR.
|
||||||
@@ -705,7 +706,7 @@ module.exports = class bitstamp extends Exchange {
|
|||||||
const duration = this.parseTimeframe (timeframe);
|
const duration = this.parseTimeframe (timeframe);
|
||||||
if (limit === undefined) {
|
if (limit === undefined) {
|
||||||
if (since === undefined) {
|
if (since === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOHLCV requires a since argument or a limit argument');
|
throw new ArgumentsRequired (this.id + ' fetchOHLCV() requires a since argument or a limit argument');
|
||||||
} else {
|
} else {
|
||||||
limit = 1000;
|
limit = 1000;
|
||||||
const start = parseInt (since / 1000);
|
const start = parseInt (since / 1000);
|
||||||
@@ -771,8 +772,8 @@ module.exports = class bitstamp extends Exchange {
|
|||||||
return {
|
return {
|
||||||
'info': balance,
|
'info': balance,
|
||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'maker': balance.fee,
|
'maker': balance['fee'],
|
||||||
'taker': balance.fee,
|
'taker': balance['fee'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1262,6 +1263,7 @@ module.exports = class bitstamp extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': undefined,
|
'type': undefined,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+71
-13
@@ -3,7 +3,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const Exchange = require ('./base/Exchange');
|
const Exchange = require ('./base/Exchange');
|
||||||
const { BadSymbol, ExchangeError, ExchangeNotAvailable, AuthenticationError, InvalidOrder, InsufficientFunds, OrderNotFound, DDoSProtection, PermissionDenied, AddressPending, OnMaintenance, BadRequest } = require ('./base/errors');
|
const { BadSymbol, ExchangeError, ExchangeNotAvailable, AuthenticationError, InvalidOrder, InsufficientFunds, OrderNotFound, DDoSProtection, PermissionDenied, AddressPending, OnMaintenance, BadRequest, InvalidAddress } = require ('./base/errors');
|
||||||
const { TRUNCATE, DECIMAL_PLACES } = require ('./base/functions/number');
|
const { TRUNCATE, DECIMAL_PLACES } = require ('./base/functions/number');
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -23,6 +23,7 @@ module.exports = class bittrex extends Exchange {
|
|||||||
'CORS': false,
|
'CORS': false,
|
||||||
'cancelAllOrders': true,
|
'cancelAllOrders': true,
|
||||||
'cancelOrder': true,
|
'cancelOrder': true,
|
||||||
|
'createDepositAddress': true,
|
||||||
'createMarketOrder': true,
|
'createMarketOrder': true,
|
||||||
'createOrder': true,
|
'createOrder': true,
|
||||||
'fetchBalance': true,
|
'fetchBalance': true,
|
||||||
@@ -137,10 +138,10 @@ module.exports = class bittrex extends Exchange {
|
|||||||
},
|
},
|
||||||
'fees': {
|
'fees': {
|
||||||
'trading': {
|
'trading': {
|
||||||
'tierBased': false,
|
'tierBased': true,
|
||||||
'percentage': true,
|
'percentage': true,
|
||||||
'maker': 0.0025,
|
'maker': 0.0035,
|
||||||
'taker': 0.0025,
|
'taker': 0.0035,
|
||||||
},
|
},
|
||||||
'funding': {
|
'funding': {
|
||||||
'tierBased': false,
|
'tierBased': false,
|
||||||
@@ -758,7 +759,22 @@ module.exports = class bittrex extends Exchange {
|
|||||||
const isCeilingMarket = (uppercaseType === 'CEILING_MARKET');
|
const isCeilingMarket = (uppercaseType === 'CEILING_MARKET');
|
||||||
const isCeilingOrder = isCeilingLimit || isCeilingMarket;
|
const isCeilingOrder = isCeilingLimit || isCeilingMarket;
|
||||||
if (isCeilingOrder) {
|
if (isCeilingOrder) {
|
||||||
request['ceiling'] = this.priceToPrecision (symbol, price);
|
let cost = undefined;
|
||||||
|
if (isCeilingLimit) {
|
||||||
|
request['limit'] = this.priceToPrecision (symbol, price);
|
||||||
|
cost = this.safeFloat2 (params, 'ceiling', 'cost', amount);
|
||||||
|
} else if (isCeilingMarket) {
|
||||||
|
cost = this.safeFloat2 (params, 'ceiling', 'cost');
|
||||||
|
if (cost === undefined) {
|
||||||
|
if (price === undefined) {
|
||||||
|
cost = amount;
|
||||||
|
} else {
|
||||||
|
cost = amount * price;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
params = this.omit (params, [ 'ceiling', 'cost' ]);
|
||||||
|
request['ceiling'] = this.costToPrecision (symbol, cost);
|
||||||
// bittrex only accepts IMMEDIATE_OR_CANCEL or FILL_OR_KILL for ceiling orders
|
// bittrex only accepts IMMEDIATE_OR_CANCEL or FILL_OR_KILL for ceiling orders
|
||||||
request['timeInForce'] = 'IMMEDIATE_OR_CANCEL';
|
request['timeInForce'] = 'IMMEDIATE_OR_CANCEL';
|
||||||
} else {
|
} else {
|
||||||
@@ -975,7 +991,7 @@ module.exports = class bittrex extends Exchange {
|
|||||||
'GOOD_TIL_CANCELLED': 'GTC',
|
'GOOD_TIL_CANCELLED': 'GTC',
|
||||||
'IMMEDIATE_OR_CANCEL': 'IOC',
|
'IMMEDIATE_OR_CANCEL': 'IOC',
|
||||||
'FILL_OR_KILL': 'FOK',
|
'FILL_OR_KILL': 'FOK',
|
||||||
'POST_ONLY_GOOD_TIL_CANCELLED': 'POST_ONLY_GOOD_TIL_CANCELLED',
|
'POST_ONLY_GOOD_TIL_CANCELLED': 'PO',
|
||||||
};
|
};
|
||||||
return this.safeString (timeInForces, timeInForce, timeInForce);
|
return this.safeString (timeInForces, timeInForce, timeInForce);
|
||||||
}
|
}
|
||||||
@@ -1045,6 +1061,7 @@ module.exports = class bittrex extends Exchange {
|
|||||||
status = 'canceled';
|
status = 'canceled';
|
||||||
}
|
}
|
||||||
const timeInForce = this.parseTimeInForce (this.safeString (order, 'timeInForce'));
|
const timeInForce = this.parseTimeInForce (this.safeString (order, 'timeInForce'));
|
||||||
|
const postOnly = (timeInForce === 'PO');
|
||||||
return {
|
return {
|
||||||
'id': this.safeString (order, 'id'),
|
'id': this.safeString (order, 'id'),
|
||||||
'clientOrderId': undefined,
|
'clientOrderId': undefined,
|
||||||
@@ -1054,6 +1071,7 @@ module.exports = class bittrex extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': timeInForce,
|
'timeInForce': timeInForce,
|
||||||
|
'postOnly': postOnly,
|
||||||
'side': direction,
|
'side': direction,
|
||||||
'price': limit,
|
'price': limit,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -1191,6 +1209,40 @@ module.exports = class bittrex extends Exchange {
|
|||||||
return this.parseOrders (response, market, since, limit);
|
return this.parseOrders (response, market, since, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async createDepositAddress (code, params = {}) {
|
||||||
|
await this.loadMarkets ();
|
||||||
|
const currency = this.currency (code);
|
||||||
|
const request = {
|
||||||
|
'currencySymbol': currency['id'],
|
||||||
|
};
|
||||||
|
const response = await this.privatePostAddresses (this.extend (request, params));
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "status":"PROVISIONED",
|
||||||
|
// "currencySymbol":"XRP",
|
||||||
|
// "cryptoAddress":"rPVMhWBsfF9iMXYj3aAzJVkPDTFNSyWdKy",
|
||||||
|
// "cryptoAddressTag":"392034158"
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
let address = this.safeString (response, 'cryptoAddress');
|
||||||
|
const message = this.safeString (response, 'status');
|
||||||
|
if (!address || message === 'REQUESTED') {
|
||||||
|
throw new AddressPending (this.id + ' the address for ' + code + ' is being generated (pending, not ready yet, retry again later)');
|
||||||
|
}
|
||||||
|
let tag = this.safeString (response, 'cryptoAddressTag');
|
||||||
|
if ((tag === undefined) && (currency['type'] in this.options['tag'])) {
|
||||||
|
tag = address;
|
||||||
|
address = currency['address'];
|
||||||
|
}
|
||||||
|
this.checkAddress (address);
|
||||||
|
return {
|
||||||
|
'currency': code,
|
||||||
|
'address': address,
|
||||||
|
'tag': tag,
|
||||||
|
'info': response,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
async fetchDepositAddress (code, params = {}) {
|
async fetchDepositAddress (code, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const currency = this.currency (code);
|
const currency = this.currency (code);
|
||||||
@@ -1198,18 +1250,21 @@ module.exports = class bittrex extends Exchange {
|
|||||||
'currencySymbol': currency['id'],
|
'currencySymbol': currency['id'],
|
||||||
};
|
};
|
||||||
const response = await this.privateGetAddressesCurrencySymbol (this.extend (request, params));
|
const response = await this.privateGetAddressesCurrencySymbol (this.extend (request, params));
|
||||||
// {
|
//
|
||||||
// "status": "PROVISIONED",
|
// {
|
||||||
// "currencySymbol": "BTC",
|
// "status":"PROVISIONED",
|
||||||
// "cryptoAddress": "1PhmYjnJPZH5NUwV8AUjqkeDkCBpbE2xqX"
|
// "currencySymbol":"XRP",
|
||||||
// }
|
// "cryptoAddress":"rPVMhWBsfF9iMXYj3aAzJVkPDTFNSyWdKy",
|
||||||
|
// "cryptoAddressTag":"392034158"
|
||||||
|
// }
|
||||||
|
//
|
||||||
let address = this.safeString (response, 'cryptoAddress');
|
let address = this.safeString (response, 'cryptoAddress');
|
||||||
const message = this.safeString (response, 'status');
|
const message = this.safeString (response, 'status');
|
||||||
if (!address || message === 'REQUESTED') {
|
if (!address || message === 'REQUESTED') {
|
||||||
throw new AddressPending (this.id + ' the address for ' + code + ' is being generated (pending, not ready yet, retry again later)');
|
throw new AddressPending (this.id + ' the address for ' + code + ' is being generated (pending, not ready yet, retry again later)');
|
||||||
}
|
}
|
||||||
let tag = undefined;
|
let tag = this.safeString (response, 'cryptoAddressTag');
|
||||||
if (currency['type'] in this.options['tag']) {
|
if ((tag === undefined) && (currency['type'] in this.options['tag'])) {
|
||||||
tag = address;
|
tag = address;
|
||||||
address = currency['address'];
|
address = currency['address'];
|
||||||
}
|
}
|
||||||
@@ -1309,6 +1364,9 @@ module.exports = class bittrex extends Exchange {
|
|||||||
this.throwExactlyMatchedException (this.exceptions['exact'], code, feedback);
|
this.throwExactlyMatchedException (this.exceptions['exact'], code, feedback);
|
||||||
this.throwBroadlyMatchedException (this.exceptions['broad'], code, feedback);
|
this.throwBroadlyMatchedException (this.exceptions['broad'], code, feedback);
|
||||||
}
|
}
|
||||||
|
if ((code === 'NOT_FOUND') && (url.indexOf ('addresses') >= 0)) {
|
||||||
|
throw new InvalidAddress (feedback);
|
||||||
|
}
|
||||||
// throw new ExchangeError (this.id + ' malformed response ' + this.json (response));
|
// throw new ExchangeError (this.id + ' malformed response ' + this.json (response));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
Vendored
+59
-22
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
const Exchange = require ('./base/Exchange');
|
const Exchange = require ('./base/Exchange');
|
||||||
const { ExchangeError, BadSymbol, AuthenticationError, InsufficientFunds, InvalidOrder, ArgumentsRequired, OrderNotFound, InvalidAddress, BadRequest, RateLimitExceeded, PermissionDenied, ExchangeNotAvailable, AccountSuspended, OnMaintenance } = require ('./base/errors');
|
const { ExchangeError, BadSymbol, AuthenticationError, InsufficientFunds, InvalidOrder, ArgumentsRequired, OrderNotFound, InvalidAddress, BadRequest, RateLimitExceeded, PermissionDenied, ExchangeNotAvailable, AccountSuspended, OnMaintenance } = require ('./base/errors');
|
||||||
const { TRUNCATE } = require ('./base/functions/number');
|
const { SIGNIFICANT_DIGITS, DECIMAL_PLACES, TRUNCATE, ROUND } = require ('./base/functions/number');
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -221,12 +221,33 @@ module.exports = class bitvavo extends Exchange {
|
|||||||
'expires': 1000, // 1 second
|
'expires': 1000, // 1 second
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'precisionMode': SIGNIFICANT_DIGITS,
|
||||||
'commonCurrencies': {
|
'commonCurrencies': {
|
||||||
'MIOTA': 'IOTA', // https://github.com/ccxt/ccxt/issues/7487
|
'MIOTA': 'IOTA', // https://github.com/ccxt/ccxt/issues/7487
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currencyToPrecision (currency, fee) {
|
||||||
|
return this.decimalToPrecision (fee, 0, this.currencies[currency]['precision']);
|
||||||
|
}
|
||||||
|
|
||||||
|
amountToPrecision (symbol, amount) {
|
||||||
|
// https://docs.bitfinex.com/docs/introduction#amount-precision
|
||||||
|
// The amount field allows up to 8 decimals.
|
||||||
|
// Anything exceeding this will be rounded to the 8th decimal.
|
||||||
|
return this.decimalToPrecision (amount, TRUNCATE, this.markets[symbol]['precision']['amount'], DECIMAL_PLACES);
|
||||||
|
}
|
||||||
|
|
||||||
|
priceToPrecision (symbol, price) {
|
||||||
|
price = this.decimalToPrecision (price, ROUND, this.markets[symbol]['precision']['price'], this.precisionMode);
|
||||||
|
// https://docs.bitfinex.com/docs/introduction#price-precision
|
||||||
|
// The precision level of all trading prices is based on significant figures.
|
||||||
|
// All pairs on Bitfinex use up to 5 significant digits and up to 8 decimals (e.g. 1.2345, 123.45, 1234.5, 0.00012345).
|
||||||
|
// Prices submit with a precision larger than 5 will be cut by the API.
|
||||||
|
return this.decimalToPrecision (price, TRUNCATE, 8, DECIMAL_PLACES);
|
||||||
|
}
|
||||||
|
|
||||||
async fetchTime (params = {}) {
|
async fetchTime (params = {}) {
|
||||||
const response = await this.publicGetTime (params);
|
const response = await this.publicGetTime (params);
|
||||||
//
|
//
|
||||||
@@ -768,16 +789,18 @@ module.exports = class bitvavo extends Exchange {
|
|||||||
const request = {
|
const request = {
|
||||||
'market': market['id'],
|
'market': market['id'],
|
||||||
'side': side,
|
'side': side,
|
||||||
'orderType': type,
|
'orderType': type, // 'market', 'limit', 'stopLoss', 'stopLossLimit', 'takeProfit', 'takeProfitLimit'
|
||||||
// 'amount': this.amountToPrecision (symbol, amount),
|
// 'amount': this.amountToPrecision (symbol, amount),
|
||||||
// 'price': this.priceToPrecision (symbol, price),
|
// 'price': this.priceToPrecision (symbol, price),
|
||||||
// 'amountQuote': this.costToPrecision (symbol, cost),
|
// 'amountQuote': this.costToPrecision (symbol, cost),
|
||||||
// 'timeInForce': 'GTC', // "GTC" "IOC" "FOK"
|
// 'timeInForce': 'GTC', // 'GTC', 'IOC', 'FOK'
|
||||||
// 'selfTradePrevention': "decrementAndCancel", // "decrementAndCancel" "cancelOldest" "cancelNewest" "cancelBoth"
|
// 'selfTradePrevention': 'decrementAndCancel', // 'decrementAndCancel', 'cancelOldest', 'cancelNewest', 'cancelBoth'
|
||||||
// 'postOnly': false,
|
// 'postOnly': false,
|
||||||
// 'disableMarketProtection': false, // don't cancel if the next fill price is 10% worse than the best fill price
|
// 'disableMarketProtection': false, // don't cancel if the next fill price is 10% worse than the best fill price
|
||||||
// 'responseRequired': true, // false is faster
|
// 'responseRequired': true, // false is faster
|
||||||
};
|
};
|
||||||
|
const isStopLimit = (type === 'stopLossLimit') || (type === 'takeProfitLimit');
|
||||||
|
const isStopMarket = (type === 'stopLoss') || (type === 'takeProfit');
|
||||||
if (type === 'market') {
|
if (type === 'market') {
|
||||||
let cost = undefined;
|
let cost = undefined;
|
||||||
if (price !== undefined) {
|
if (price !== undefined) {
|
||||||
@@ -795,6 +818,26 @@ module.exports = class bitvavo extends Exchange {
|
|||||||
} else if (type === 'limit') {
|
} else if (type === 'limit') {
|
||||||
request['price'] = this.priceToPrecision (symbol, price);
|
request['price'] = this.priceToPrecision (symbol, price);
|
||||||
request['amount'] = this.amountToPrecision (symbol, amount);
|
request['amount'] = this.amountToPrecision (symbol, amount);
|
||||||
|
} else if (isStopMarket || isStopLimit) {
|
||||||
|
let stopPrice = this.safeFloat2 (params, 'stopPrice', 'triggerAmount');
|
||||||
|
if (stopPrice === undefined) {
|
||||||
|
if (isStopLimit) {
|
||||||
|
throw new ArgumentsRequired (this.id + ' createOrder requires a stopPrice parameter for a ' + type + ' order');
|
||||||
|
} else if (isStopMarket) {
|
||||||
|
if (price === undefined) {
|
||||||
|
throw new ArgumentsRequired (this.id + ' createOrder requires a price argument or a stopPrice parameter for a ' + type + ' order');
|
||||||
|
} else {
|
||||||
|
stopPrice = price;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isStopLimit) {
|
||||||
|
request['price'] = this.priceToPrecision (symbol, price);
|
||||||
|
}
|
||||||
|
params = this.omit (params, [ 'stopPrice', 'triggerAmount' ]);
|
||||||
|
request['triggerAmount'] = this.priceToPrecision (symbol, stopPrice);
|
||||||
|
request['triggerType'] = 'price';
|
||||||
|
request['amount'] = this.amountToPrecision (symbol, amount);
|
||||||
}
|
}
|
||||||
const response = await this.privatePostOrder (this.extend (request, params));
|
const response = await this.privatePostOrder (this.extend (request, params));
|
||||||
//
|
//
|
||||||
@@ -856,13 +899,13 @@ module.exports = class bitvavo extends Exchange {
|
|||||||
const response = await this.privatePutOrder (this.extend (request, params));
|
const response = await this.privatePutOrder (this.extend (request, params));
|
||||||
return this.parseOrder (response, market);
|
return this.parseOrder (response, market);
|
||||||
} else {
|
} else {
|
||||||
throw new ArgumentsRequired (this.id + ' editOrder requires an amount argument, or a price argument, or non-empty params');
|
throw new ArgumentsRequired (this.id + ' editOrder() requires an amount argument, or a price argument, or non-empty params');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -900,7 +943,7 @@ module.exports = class bitvavo extends Exchange {
|
|||||||
|
|
||||||
async fetchOrder (id, symbol = undefined, params = {}) {
|
async fetchOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
@@ -949,7 +992,7 @@ module.exports = class bitvavo extends Exchange {
|
|||||||
|
|
||||||
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -1010,24 +1053,13 @@ module.exports = class bitvavo extends Exchange {
|
|||||||
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {
|
const request = {
|
||||||
// 'market': market['id'],
|
// 'market': market['id'], // rate limit 25 without a market, 1 with market specified
|
||||||
// 'limit': 500,
|
|
||||||
// 'start': since,
|
|
||||||
// 'end': this.milliseconds (),
|
|
||||||
// 'orderIdFrom': 'af76d6ce-9f7c-4006-b715-bb5d430652d0',
|
|
||||||
// 'orderIdTo': 'af76d6ce-9f7c-4006-b715-bb5d430652d0',
|
|
||||||
};
|
};
|
||||||
let market = undefined;
|
let market = undefined;
|
||||||
if (symbol !== undefined) {
|
if (symbol !== undefined) {
|
||||||
market = this.market (symbol);
|
market = this.market (symbol);
|
||||||
request['market'] = market['id'];
|
request['market'] = market['id'];
|
||||||
}
|
}
|
||||||
if (since !== undefined) {
|
|
||||||
request['start'] = since;
|
|
||||||
}
|
|
||||||
if (limit !== undefined) {
|
|
||||||
request['limit'] = limit; // default 500, max 1000
|
|
||||||
}
|
|
||||||
const response = await this.privateGetOrdersOpen (this.extend (request, params));
|
const response = await this.privateGetOrdersOpen (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// [
|
// [
|
||||||
@@ -1082,6 +1114,7 @@ module.exports = class bitvavo extends Exchange {
|
|||||||
'partiallyFilled': 'open',
|
'partiallyFilled': 'open',
|
||||||
'expired': 'canceled',
|
'expired': 'canceled',
|
||||||
'rejected': 'canceled',
|
'rejected': 'canceled',
|
||||||
|
'awaitingTrigger': 'open', // https://github.com/ccxt/ccxt/issues/8489
|
||||||
};
|
};
|
||||||
return this.safeString (statuses, status, status);
|
return this.safeString (statuses, status, status);
|
||||||
}
|
}
|
||||||
@@ -1183,6 +1216,9 @@ module.exports = class bitvavo extends Exchange {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const timeInForce = this.safeString (order, 'timeInForce');
|
const timeInForce = this.safeString (order, 'timeInForce');
|
||||||
|
const postOnly = this.safeValue (order, 'postOnly');
|
||||||
|
// https://github.com/ccxt/ccxt/issues/8489
|
||||||
|
const stopPrice = this.safeFloat (order, 'triggerPrice');
|
||||||
return {
|
return {
|
||||||
'info': order,
|
'info': order,
|
||||||
'id': id,
|
'id': id,
|
||||||
@@ -1193,9 +1229,10 @@ module.exports = class bitvavo extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': timeInForce,
|
'timeInForce': timeInForce,
|
||||||
|
'postOnly': postOnly,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': stopPrice,
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
'cost': cost,
|
'cost': cost,
|
||||||
'average': average,
|
'average': average,
|
||||||
@@ -1209,7 +1246,7 @@ module.exports = class bitvavo extends Exchange {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
|
|||||||
Generated
Vendored
+3
-2
@@ -675,7 +675,7 @@ module.exports = class bitz extends Exchange {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (since !== undefined) {
|
if (since !== undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOHLCV requires a limit argument if the since argument is specified');
|
throw new ArgumentsRequired (this.id + ' fetchOHLCV() requires a limit argument if the since argument is specified');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const response = await this.marketGetKline (this.extend (request, params));
|
const response = await this.marketGetKline (this.extend (request, params));
|
||||||
@@ -779,6 +779,7 @@ module.exports = class bitz extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -948,7 +949,7 @@ module.exports = class bitz extends Exchange {
|
|||||||
|
|
||||||
async fetchOrdersWithMethod (method, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOrdersWithMethod (method, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOpenOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOpenOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
|
|||||||
Generated
Vendored
+1
@@ -662,6 +662,7 @@ module.exports = class bleutrade extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+1
@@ -460,6 +460,7 @@ module.exports = class braziliex extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+1
@@ -348,6 +348,7 @@ module.exports = class btcalpha extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+1
@@ -306,6 +306,7 @@ module.exports = class btcbox extends Exchange {
|
|||||||
'side': side,
|
'side': side,
|
||||||
'type': undefined,
|
'type': undefined,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'status': status,
|
'status': status,
|
||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'price': price,
|
'price': price,
|
||||||
|
|||||||
Generated
Vendored
+2
@@ -865,6 +865,7 @@ module.exports = class btcmarkets extends Exchange {
|
|||||||
const clientOrderId = this.safeString (order, 'clientOrderId');
|
const clientOrderId = this.safeString (order, 'clientOrderId');
|
||||||
const timeInForce = this.safeString (order, 'timeInForce');
|
const timeInForce = this.safeString (order, 'timeInForce');
|
||||||
const stopPrice = this.safeFloat (order, 'triggerPrice');
|
const stopPrice = this.safeFloat (order, 'triggerPrice');
|
||||||
|
const postOnly = this.safeValue (order, 'postOnly');
|
||||||
return {
|
return {
|
||||||
'info': order,
|
'info': order,
|
||||||
'id': id,
|
'id': id,
|
||||||
@@ -875,6 +876,7 @@ module.exports = class btcmarkets extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': timeInForce,
|
'timeInForce': timeInForce,
|
||||||
|
'postOnly': postOnly,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': stopPrice,
|
'stopPrice': stopPrice,
|
||||||
|
|||||||
Generated
Vendored
+2
-1
@@ -335,6 +335,7 @@ module.exports = class btctradeua extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': undefined,
|
'type': undefined,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': this.safeString (order, 'type'),
|
'side': this.safeString (order, 'type'),
|
||||||
'price': this.safeFloat (order, 'price'),
|
'price': this.safeFloat (order, 'price'),
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -351,7 +352,7 @@ module.exports = class btctradeua extends Exchange {
|
|||||||
|
|
||||||
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOpenOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOpenOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
|
|||||||
Generated
Vendored
+1
-1
@@ -275,7 +275,7 @@ module.exports = class btcturk extends Exchange {
|
|||||||
};
|
};
|
||||||
if (type === 'market') {
|
if (type === 'market') {
|
||||||
if (!('Total' in params)) {
|
if (!('Total' in params)) {
|
||||||
throw new ExchangeError (this.id + ' createOrder requires the "Total" extra parameter for market orders (amount and price are both ignored)');
|
throw new ExchangeError (this.id + ' createOrder() requires the "Total" extra parameter for market orders (amount and price are both ignored)');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
request['Price'] = price;
|
request['Price'] = price;
|
||||||
|
|||||||
Generated
Vendored
+52
-16
@@ -537,29 +537,65 @@ module.exports = class buda extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parseOrder (order, market = undefined) {
|
parseOrder (order, market = undefined) {
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// 'id': 63679183,
|
||||||
|
// 'uuid': 'f9697bee-627e-4175-983f-0d5a41963fec',
|
||||||
|
// 'market_id': 'ETH-CLP',
|
||||||
|
// 'account_id': 51590,
|
||||||
|
// 'type': 'Ask',
|
||||||
|
// 'state': 'received',
|
||||||
|
// 'created_at': '2021-01-04T08:29:52.730Z',
|
||||||
|
// 'fee_currency': 'CLP',
|
||||||
|
// 'price_type': 'limit',
|
||||||
|
// 'source': None,
|
||||||
|
// 'limit': ['741000.0', 'CLP'],
|
||||||
|
// 'amount': ['0.001', 'ETH'],
|
||||||
|
// 'original_amount': ['0.001', 'ETH'],
|
||||||
|
// 'traded_amount': ['0.0', 'ETH'],
|
||||||
|
// 'total_exchanged': ['0.0', 'CLP'],
|
||||||
|
// 'paid_fee': ['0.0', 'CLP']
|
||||||
|
// }
|
||||||
|
//
|
||||||
const id = this.safeString (order, 'id');
|
const id = this.safeString (order, 'id');
|
||||||
const timestamp = this.parse8601 (this.safeString (order, 'created_at'));
|
const timestamp = this.parse8601 (this.safeString (order, 'created_at'));
|
||||||
const marketId = this.safeString (order, 'market_id');
|
const marketId = this.safeString (order, 'market_id');
|
||||||
const symbol = this.safeSymbol (marketId, market);
|
const symbol = this.safeSymbol (marketId, market, '-');
|
||||||
const type = this.safeString (order, 'price_type');
|
const type = this.safeString (order, 'price_type');
|
||||||
const side = this.safeStringLower (order, 'type');
|
const side = this.safeStringLower (order, 'type');
|
||||||
const status = this.parseOrderStatus (this.safeString (order, 'state'));
|
const status = this.parseOrderStatus (this.safeString (order, 'state'));
|
||||||
const amount = parseFloat (order['original_amount'][0]);
|
const originalAmount = this.safeValue (order, 'original_amount', []);
|
||||||
const remaining = parseFloat (order['amount'][0]);
|
const amount = this.safeFloat (originalAmount, 0);
|
||||||
const filled = parseFloat (order['traded_amount'][0]);
|
const remainingAmount = this.safeValue (order, 'amount', []);
|
||||||
const cost = parseFloat (order['total_exchanged'][0]);
|
const remaining = this.safeFloat (remainingAmount, 0);
|
||||||
let price = this.safeFloat (order, 'limit');
|
const tradedAmount = this.safeValue (order, 'traded_amount', []);
|
||||||
if (price !== undefined) {
|
const filled = this.safeFloat (tradedAmount, 0);
|
||||||
price = parseFloat (price[0]);
|
const totalExchanged = this.safeValue (order, 'totalExchanged', []);
|
||||||
|
const cost = this.safeFloat (totalExchanged, 0);
|
||||||
|
const limitPrice = this.safeValue (order, 'limit', []);
|
||||||
|
let price = this.safeFloat (limitPrice, 0);
|
||||||
|
if (price === undefined) {
|
||||||
|
if (limitPrice !== undefined) {
|
||||||
|
price = limitPrice;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (cost > 0 && filled > 0) {
|
let average = undefined;
|
||||||
price = this.priceToPrecision (symbol, cost / filled);
|
if ((cost !== undefined) && (filled !== undefined) && (filled > 0)) {
|
||||||
|
average = this.priceToPrecision (symbol, cost / filled);
|
||||||
|
}
|
||||||
|
const paidFee = this.safeValue (order, 'paid_fee', []);
|
||||||
|
const feeCost = this.safeFloat (paidFee, 0);
|
||||||
|
let fee = undefined;
|
||||||
|
if (feeCost !== undefined) {
|
||||||
|
const feeCurrencyId = this.safeString (paidFee, 1);
|
||||||
|
const feeCurrencyCode = this.safeCurrencyCode (feeCurrencyId);
|
||||||
|
fee = {
|
||||||
|
'cost': feeCost,
|
||||||
|
'code': feeCurrencyCode,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
const fee = {
|
|
||||||
'cost': parseFloat (order['paid_fee'][0]),
|
|
||||||
'currency': order['paid_fee'][1],
|
|
||||||
};
|
|
||||||
return {
|
return {
|
||||||
|
'info': order,
|
||||||
'id': id,
|
'id': id,
|
||||||
'clientOrderId': undefined,
|
'clientOrderId': undefined,
|
||||||
'datetime': this.iso8601 (timestamp),
|
'datetime': this.iso8601 (timestamp),
|
||||||
@@ -569,17 +605,17 @@ module.exports = class buda extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
'average': average,
|
||||||
'cost': cost,
|
'cost': cost,
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
'filled': filled,
|
'filled': filled,
|
||||||
'remaining': remaining,
|
'remaining': remaining,
|
||||||
'trades': undefined,
|
'trades': undefined,
|
||||||
'fee': fee,
|
'fee': fee,
|
||||||
'info': order,
|
|
||||||
'average': undefined,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Generated
Vendored
+3
-2
@@ -761,6 +761,7 @@ module.exports = class bw extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -777,7 +778,7 @@ module.exports = class bw extends Exchange {
|
|||||||
|
|
||||||
async fetchOrder (id, symbol = undefined, params = {}) {
|
async fetchOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -812,7 +813,7 @@ module.exports = class bw extends Exchange {
|
|||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
|
|||||||
Generated
Vendored
+288
-275
@@ -17,6 +17,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
'version': 'v2',
|
'version': 'v2',
|
||||||
'userAgent': undefined,
|
'userAgent': undefined,
|
||||||
'rateLimit': 100,
|
'rateLimit': 100,
|
||||||
|
'hostname': 'bybit.com', // bybit.com, bytick.com
|
||||||
'has': {
|
'has': {
|
||||||
'cancelOrder': true,
|
'cancelOrder': true,
|
||||||
'CORS': true,
|
'CORS': true,
|
||||||
@@ -59,9 +60,9 @@ module.exports = class bybit extends Exchange {
|
|||||||
'1y': 'Y',
|
'1y': 'Y',
|
||||||
},
|
},
|
||||||
'urls': {
|
'urls': {
|
||||||
'test': 'https://api-testnet.bybit.com',
|
'test': 'https://api-testnet.{hostname}',
|
||||||
'logo': 'https://user-images.githubusercontent.com/51840849/76547799-daff5b80-649e-11ea-87fb-3be9bac08954.jpg',
|
'logo': 'https://user-images.githubusercontent.com/51840849/76547799-daff5b80-649e-11ea-87fb-3be9bac08954.jpg',
|
||||||
'api': 'https://api.bybit.com',
|
'api': 'https://api.{hostname}',
|
||||||
'www': 'https://www.bybit.com',
|
'www': 'https://www.bybit.com',
|
||||||
'doc': [
|
'doc': [
|
||||||
'https://bybit-exchange.github.io/docs/inverse/',
|
'https://bybit-exchange.github.io/docs/inverse/',
|
||||||
@@ -72,117 +73,112 @@ module.exports = class bybit extends Exchange {
|
|||||||
'referral': 'https://www.bybit.com/app/register?ref=X7Prm',
|
'referral': 'https://www.bybit.com/app/register?ref=X7Prm',
|
||||||
},
|
},
|
||||||
'api': {
|
'api': {
|
||||||
|
'v2': {
|
||||||
|
'public': {
|
||||||
|
'get': [
|
||||||
|
'orderBook/L2',
|
||||||
|
'kline/list',
|
||||||
|
'tickers',
|
||||||
|
'trading-records',
|
||||||
|
'symbols',
|
||||||
|
'liq-records',
|
||||||
|
'mark-price-kline',
|
||||||
|
'index-price-kline',
|
||||||
|
'premium-index-kline',
|
||||||
|
'open-interest',
|
||||||
|
'big-deal',
|
||||||
|
'account-ratio',
|
||||||
|
'time',
|
||||||
|
'announcement',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
'private': {
|
||||||
|
'get': [
|
||||||
|
'order/list',
|
||||||
|
'order',
|
||||||
|
'stop-order/list',
|
||||||
|
'stop-order',
|
||||||
|
'position/list',
|
||||||
|
'execution/list',
|
||||||
|
'trade/closed-pnl/list',
|
||||||
|
'funding/prev-funding-rate',
|
||||||
|
'funding/prev-funding',
|
||||||
|
'funding/predicted-funding',
|
||||||
|
'account/api-key',
|
||||||
|
'account/lcp',
|
||||||
|
'wallet/balance',
|
||||||
|
'wallet/fund/records',
|
||||||
|
'wallet/withdraw/list',
|
||||||
|
'exchange-order/list',
|
||||||
|
],
|
||||||
|
'post': [
|
||||||
|
'order/create',
|
||||||
|
'order/cancel',
|
||||||
|
'order/cancelAll',
|
||||||
|
'order/replace',
|
||||||
|
'stop-order/create',
|
||||||
|
'stop-order/cancel',
|
||||||
|
'stop-order/cancelAll',
|
||||||
|
'stop-order/replace',
|
||||||
|
'position/change-position-margin',
|
||||||
|
'position/trading-stop',
|
||||||
|
'position/leverage/save',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
'public': {
|
'public': {
|
||||||
'get': [
|
'linear': {
|
||||||
'orderBook/L2',
|
'get': [
|
||||||
'kline/list',
|
'kline',
|
||||||
'tickers',
|
'recent-trading-records',
|
||||||
'trading-records',
|
'funding/prev-funding-rate',
|
||||||
'symbols',
|
'mark-price-kline',
|
||||||
'liq-records',
|
'index-price-kline',
|
||||||
'mark-price-kline',
|
'premium-index-kline',
|
||||||
'open-interest',
|
'risk-limit',
|
||||||
'big-deal',
|
],
|
||||||
'account-ratio',
|
},
|
||||||
'time',
|
|
||||||
'announcement',
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
'private': {
|
'private': {
|
||||||
'get': [
|
'linear': {
|
||||||
'order/list',
|
'get': [
|
||||||
'order',
|
'order/list',
|
||||||
'stop-order/list',
|
'order/search',
|
||||||
'stop-order',
|
'stop-order/list',
|
||||||
'position/list',
|
'stop-order/search',
|
||||||
'wallet/balance',
|
'position/list',
|
||||||
'execution/list',
|
'trade/execution/list',
|
||||||
'trade/closed-pnl/list',
|
'trade/closed-pnl/list',
|
||||||
'account/lcp',
|
'funding/predicted-funding',
|
||||||
'exchange-order/list',
|
'funding/prev-funding',
|
||||||
],
|
],
|
||||||
'post': [
|
'post': [
|
||||||
'order/create',
|
'order/create',
|
||||||
'order/cancel',
|
'order/cancel',
|
||||||
'order/cancelAll',
|
'order/cancel-all',
|
||||||
'order/replace',
|
'order/replace',
|
||||||
'stop-order/create',
|
'stop-order/create',
|
||||||
'stop-order/cancel',
|
'stop-order/cancel',
|
||||||
'stop-order/cancelAll',
|
'stop-order/cancel-all',
|
||||||
'stop-order/replace',
|
'stop-order/replace',
|
||||||
],
|
'position/set-auto-add-margin',
|
||||||
|
'position/switch-isolated',
|
||||||
|
'tpsl/switch-mode',
|
||||||
|
'position/add-margin',
|
||||||
|
'position/set-leverage',
|
||||||
|
'position/trading-stop',
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'openapi': {
|
'openapi': {
|
||||||
'get': [
|
'wallet': {
|
||||||
'order/list', // deprecated
|
'get': [
|
||||||
'stop-order/list', // deprecated
|
'risk-limit/list',
|
||||||
'wallet/risk-limit/list',
|
],
|
||||||
'funding/prev-funding-rate',
|
'post': [
|
||||||
'funding/prev-funding',
|
'risk-limit',
|
||||||
'funding/predicted-funding',
|
],
|
||||||
'api-key',
|
},
|
||||||
'wallet/fund/records',
|
|
||||||
'wallet/withdraw/list',
|
|
||||||
],
|
|
||||||
'post': [
|
|
||||||
'order/replace', // deprecated
|
|
||||||
'stop-order/create', // deprecated
|
|
||||||
'stop-order/cancel', // deprecated
|
|
||||||
'stop-order/replace', // deprecated
|
|
||||||
'position/trading-stop',
|
|
||||||
'wallet/risk-limit',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
'publicLinear': {
|
|
||||||
'get': [
|
|
||||||
'kline',
|
|
||||||
'recent-trading-records',
|
|
||||||
'funding/prev-funding-rate',
|
|
||||||
'mark-price-kline',
|
|
||||||
'risk-limit',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
'privateLinear': {
|
|
||||||
'get': [
|
|
||||||
'order/list',
|
|
||||||
'order/search',
|
|
||||||
'stop-order/list',
|
|
||||||
'stop-order/search',
|
|
||||||
'position/list',
|
|
||||||
'trade/execution/list',
|
|
||||||
'trade/closed-pnl/list',
|
|
||||||
'funding/prev-funding',
|
|
||||||
'funding/predicted-funding',
|
|
||||||
],
|
|
||||||
'post': [
|
|
||||||
'order/create',
|
|
||||||
'order/cancel',
|
|
||||||
'order/cancel-all',
|
|
||||||
'order/replace',
|
|
||||||
'stop-order/create',
|
|
||||||
'stop-order/cancel',
|
|
||||||
'stop-order/cancel-all',
|
|
||||||
'stop-order/replace',
|
|
||||||
'position/switch-isolated',
|
|
||||||
'position/set-auto-add-margin',
|
|
||||||
'tpsl/switch-mode',
|
|
||||||
'position/set-leverage',
|
|
||||||
'position/trading-stop',
|
|
||||||
'position/add-margin',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
'position': {
|
|
||||||
'post': [
|
|
||||||
'change-position-margin',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
'user': {
|
|
||||||
'get': [
|
|
||||||
'leverage', // deprecated
|
|
||||||
],
|
|
||||||
'post': [
|
|
||||||
'leverage/save',
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'httpExceptions': {
|
'httpExceptions': {
|
||||||
@@ -285,6 +281,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
'options': {
|
'options': {
|
||||||
'marketTypes': {
|
'marketTypes': {
|
||||||
'BTC/USDT': 'linear',
|
'BTC/USDT': 'linear',
|
||||||
|
'BCH/USDT': 'linear',
|
||||||
'ETH/USDT': 'linear',
|
'ETH/USDT': 'linear',
|
||||||
'LTC/USDT': 'linear',
|
'LTC/USDT': 'linear',
|
||||||
'XTZ/USDT': 'linear',
|
'XTZ/USDT': 'linear',
|
||||||
@@ -292,10 +289,10 @@ module.exports = class bybit extends Exchange {
|
|||||||
},
|
},
|
||||||
'code': 'BTC',
|
'code': 'BTC',
|
||||||
'cancelAllOrders': {
|
'cancelAllOrders': {
|
||||||
'method': 'privatePostOrderCancelAll', // privatePostStopOrderCancelAll
|
// 'method': 'v2PrivatePostOrderCancelAll', // v2PrivatePostStopOrderCancelAll
|
||||||
},
|
},
|
||||||
'recvWindow': 5 * 1000, // 5 sec default
|
'recvWindow': 5 * 1000, // 5 sec default
|
||||||
'timeDifference': 0, // the difference between system clock and Binance clock
|
'timeDifference': 0, // the difference between system clock and exchange server clock
|
||||||
'adjustForTimeDifference': false, // controls the adjustment logic upon instantiation
|
'adjustForTimeDifference': false, // controls the adjustment logic upon instantiation
|
||||||
},
|
},
|
||||||
'fees': {
|
'fees': {
|
||||||
@@ -327,7 +324,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchTime (params = {}) {
|
async fetchTime (params = {}) {
|
||||||
const response = await this.publicGetTime (params);
|
const response = await this.v2PublicGetTime (params);
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// ret_code: 0,
|
// ret_code: 0,
|
||||||
@@ -345,30 +342,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
if (this.options['adjustForTimeDifference']) {
|
if (this.options['adjustForTimeDifference']) {
|
||||||
await this.loadTimeDifference ();
|
await this.loadTimeDifference ();
|
||||||
}
|
}
|
||||||
const response = await this.publicGetSymbols (params);
|
const response = await this.v2PublicGetSymbols (params);
|
||||||
//
|
|
||||||
// {
|
|
||||||
// ret_code: 0,
|
|
||||||
// ret_msg: 'OK',
|
|
||||||
// ext_code: '',
|
|
||||||
// ext_info: '',
|
|
||||||
// result: [
|
|
||||||
// {
|
|
||||||
// name: 'BTCUSD',
|
|
||||||
// base_currency: 'BTC',
|
|
||||||
// quote_currency: 'USD',
|
|
||||||
// price_scale: 2,
|
|
||||||
// taker_fee: '0.00075',
|
|
||||||
// maker_fee: '-0.00025',
|
|
||||||
// leverage_filter: { min_leverage: 1, max_leverage: 100, leverage_step: '0.01' },
|
|
||||||
// price_filter: { min_price: '0.5', max_price: '999999.5', tick_size: '0.5' },
|
|
||||||
// lot_size_filter: { max_trading_qty: 1000000, min_trading_qty: 1, qty_step: 1 }
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// time_now: '1583930495.454196'
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// sandbox/testnet
|
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// "ret_code":0,
|
// "ret_code":0,
|
||||||
@@ -377,8 +351,8 @@ module.exports = class bybit extends Exchange {
|
|||||||
// "ext_info":"",
|
// "ext_info":"",
|
||||||
// "result":[
|
// "result":[
|
||||||
// {
|
// {
|
||||||
// "symbol":"BTCUSD",
|
// "name":"BTCUSD",
|
||||||
// "symbol_alias":"BTCUSD",
|
// "alias":"BTCUSD",
|
||||||
// "status":"Trading",
|
// "status":"Trading",
|
||||||
// "base_currency":"BTC",
|
// "base_currency":"BTC",
|
||||||
// "quote_currency":"USD",
|
// "quote_currency":"USD",
|
||||||
@@ -388,9 +362,22 @@ module.exports = class bybit extends Exchange {
|
|||||||
// "leverage_filter":{"min_leverage":1,"max_leverage":100,"leverage_step":"0.01"},
|
// "leverage_filter":{"min_leverage":1,"max_leverage":100,"leverage_step":"0.01"},
|
||||||
// "price_filter":{"min_price":"0.5","max_price":"999999.5","tick_size":"0.5"},
|
// "price_filter":{"min_price":"0.5","max_price":"999999.5","tick_size":"0.5"},
|
||||||
// "lot_size_filter":{"max_trading_qty":1000000,"min_trading_qty":1,"qty_step":1}
|
// "lot_size_filter":{"max_trading_qty":1000000,"min_trading_qty":1,"qty_step":1}
|
||||||
// }
|
// },
|
||||||
|
// {
|
||||||
|
// "name":"BTCUSDT",
|
||||||
|
// "alias":"BTCUSDT",
|
||||||
|
// "status":"Trading",
|
||||||
|
// "base_currency":"BTC",
|
||||||
|
// "quote_currency":"USDT",
|
||||||
|
// "price_scale":2,
|
||||||
|
// "taker_fee":"0.00075",
|
||||||
|
// "maker_fee":"-0.00025",
|
||||||
|
// "leverage_filter":{"min_leverage":1,"max_leverage":100,"leverage_step":"0.01"},
|
||||||
|
// "price_filter":{"min_price":"0.5","max_price":"999999.5","tick_size":"0.5"},
|
||||||
|
// "lot_size_filter":{"max_trading_qty":100,"min_trading_qty":0.001,"qty_step":0.001}
|
||||||
|
// },
|
||||||
// ],
|
// ],
|
||||||
// "time_now":"1605916574.118500"
|
// "time_now":"1610539664.818033"
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
const markets = this.safeValue (response, 'result', []);
|
const markets = this.safeValue (response, 'result', []);
|
||||||
@@ -457,65 +444,6 @@ module.exports = class bybit extends Exchange {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchBalance (params = {}) {
|
|
||||||
await this.loadMarkets ();
|
|
||||||
const request = {};
|
|
||||||
const coin = this.safeString (params, 'coin');
|
|
||||||
const code = this.safeString (params, 'code');
|
|
||||||
if (coin !== undefined) {
|
|
||||||
request['coin'] = coin;
|
|
||||||
} else if (code !== undefined) {
|
|
||||||
const currency = this.currency (code);
|
|
||||||
request['coin'] = currency['id'];
|
|
||||||
}
|
|
||||||
const response = await this.privateGetWalletBalance (this.extend (request, params));
|
|
||||||
//
|
|
||||||
// {
|
|
||||||
// ret_code: 0,
|
|
||||||
// ret_msg: 'OK',
|
|
||||||
// ext_code: '',
|
|
||||||
// ext_info: '',
|
|
||||||
// result: {
|
|
||||||
// BTC: {
|
|
||||||
// equity: 0,
|
|
||||||
// available_balance: 0,
|
|
||||||
// used_margin: 0,
|
|
||||||
// order_margin: 0,
|
|
||||||
// position_margin: 0,
|
|
||||||
// occ_closing_fee: 0,
|
|
||||||
// occ_funding_fee: 0,
|
|
||||||
// wallet_balance: 0,
|
|
||||||
// realised_pnl: 0,
|
|
||||||
// unrealised_pnl: 0,
|
|
||||||
// cum_realised_pnl: 0,
|
|
||||||
// given_cash: 0,
|
|
||||||
// service_cash: 0
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// time_now: '1583937810.370020',
|
|
||||||
// rate_limit_status: 119,
|
|
||||||
// rate_limit_reset_ms: 1583937810367,
|
|
||||||
// rate_limit: 120
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
const result = {
|
|
||||||
'info': response,
|
|
||||||
};
|
|
||||||
const balances = this.safeValue (response, 'result', {});
|
|
||||||
const currencyIds = Object.keys (balances);
|
|
||||||
for (let i = 0; i < currencyIds.length; i++) {
|
|
||||||
const currencyId = currencyIds[i];
|
|
||||||
const balance = balances[currencyId];
|
|
||||||
const code = this.safeCurrencyCode (currencyId);
|
|
||||||
const account = this.account ();
|
|
||||||
account['free'] = this.safeFloat (balance, 'available_balance');
|
|
||||||
account['used'] = this.safeFloat (balance, 'used_margin');
|
|
||||||
account['total'] = this.safeFloat (balance, 'equity');
|
|
||||||
result[code] = account;
|
|
||||||
}
|
|
||||||
return this.parseBalance (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
parseTicker (ticker, market = undefined) {
|
parseTicker (ticker, market = undefined) {
|
||||||
//
|
//
|
||||||
// fetchTicker
|
// fetchTicker
|
||||||
@@ -594,7 +522,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
const request = {
|
const request = {
|
||||||
'symbol': market['id'],
|
'symbol': market['id'],
|
||||||
};
|
};
|
||||||
const response = await this.publicGetTickers (this.extend (request, params));
|
const response = await this.v2PublicGetTickers (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// ret_code: 0,
|
// ret_code: 0,
|
||||||
@@ -642,7 +570,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
|
|
||||||
async fetchTickers (symbols = undefined, params = {}) {
|
async fetchTickers (symbols = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const response = await this.publicGetTickers (params);
|
const response = await this.v2PublicGetTickers (params);
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// ret_code: 0,
|
// ret_code: 0,
|
||||||
@@ -740,7 +668,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
const now = this.seconds ();
|
const now = this.seconds ();
|
||||||
if (since === undefined) {
|
if (since === undefined) {
|
||||||
if (limit === undefined) {
|
if (limit === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOHLCV requires a since argument or a limit argument');
|
throw new ArgumentsRequired (this.id + ' fetchOHLCV() requires a since argument or a limit argument');
|
||||||
} else {
|
} else {
|
||||||
request['from'] = now - limit * duration;
|
request['from'] = now - limit * duration;
|
||||||
}
|
}
|
||||||
@@ -752,7 +680,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
}
|
}
|
||||||
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
||||||
const marketType = this.safeString (marketTypes, symbol);
|
const marketType = this.safeString (marketTypes, symbol);
|
||||||
const method = (marketType === 'linear') ? 'publicLinearGetKline' : 'publicGetKlineList';
|
const method = (marketType === 'linear') ? 'publicLinearGetKline' : 'v2PublicGetKlineList';
|
||||||
const response = await this[method] (this.extend (request, params));
|
const response = await this[method] (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// inverse perpetual BTC/USD
|
// inverse perpetual BTC/USD
|
||||||
@@ -907,7 +835,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
}
|
}
|
||||||
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
||||||
const marketType = this.safeString (marketTypes, symbol);
|
const marketType = this.safeString (marketTypes, symbol);
|
||||||
const method = (marketType === 'linear') ? 'publicLinearGetRecentTradingRecords' : 'publicGetTradingRecords';
|
const method = (marketType === 'linear') ? 'publicLinearGetRecentTradingRecords' : 'v2PublicGetTradingRecords';
|
||||||
const response = await this[method] (this.extend (request, params));
|
const response = await this[method] (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
@@ -961,7 +889,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
const request = {
|
const request = {
|
||||||
'symbol': market['id'],
|
'symbol': market['id'],
|
||||||
};
|
};
|
||||||
const response = await this.publicGetOrderBookL2 (this.extend (request, params));
|
const response = await this.v2PublicGetOrderBookL2 (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// ret_code: 0,
|
// ret_code: 0,
|
||||||
@@ -984,6 +912,65 @@ module.exports = class bybit extends Exchange {
|
|||||||
return this.parseOrderBook (result, timestamp, 'Buy', 'Sell', 'price', 'size');
|
return this.parseOrderBook (result, timestamp, 'Buy', 'Sell', 'price', 'size');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fetchBalance (params = {}) {
|
||||||
|
await this.loadMarkets ();
|
||||||
|
const request = {};
|
||||||
|
const coin = this.safeString (params, 'coin');
|
||||||
|
const code = this.safeString (params, 'code');
|
||||||
|
if (coin !== undefined) {
|
||||||
|
request['coin'] = coin;
|
||||||
|
} else if (code !== undefined) {
|
||||||
|
const currency = this.currency (code);
|
||||||
|
request['coin'] = currency['id'];
|
||||||
|
}
|
||||||
|
const response = await this.v2PrivateGetWalletBalance (this.extend (request, params));
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// ret_code: 0,
|
||||||
|
// ret_msg: 'OK',
|
||||||
|
// ext_code: '',
|
||||||
|
// ext_info: '',
|
||||||
|
// result: {
|
||||||
|
// BTC: {
|
||||||
|
// equity: 0,
|
||||||
|
// available_balance: 0,
|
||||||
|
// used_margin: 0,
|
||||||
|
// order_margin: 0,
|
||||||
|
// position_margin: 0,
|
||||||
|
// occ_closing_fee: 0,
|
||||||
|
// occ_funding_fee: 0,
|
||||||
|
// wallet_balance: 0,
|
||||||
|
// realised_pnl: 0,
|
||||||
|
// unrealised_pnl: 0,
|
||||||
|
// cum_realised_pnl: 0,
|
||||||
|
// given_cash: 0,
|
||||||
|
// service_cash: 0
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// time_now: '1583937810.370020',
|
||||||
|
// rate_limit_status: 119,
|
||||||
|
// rate_limit_reset_ms: 1583937810367,
|
||||||
|
// rate_limit: 120
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
const result = {
|
||||||
|
'info': response,
|
||||||
|
};
|
||||||
|
const balances = this.safeValue (response, 'result', {});
|
||||||
|
const currencyIds = Object.keys (balances);
|
||||||
|
for (let i = 0; i < currencyIds.length; i++) {
|
||||||
|
const currencyId = currencyIds[i];
|
||||||
|
const balance = balances[currencyId];
|
||||||
|
const code = this.safeCurrencyCode (currencyId);
|
||||||
|
const account = this.account ();
|
||||||
|
account['free'] = this.safeFloat (balance, 'available_balance');
|
||||||
|
account['used'] = this.safeFloat (balance, 'used_margin');
|
||||||
|
account['total'] = this.safeFloat (balance, 'equity');
|
||||||
|
result[code] = account;
|
||||||
|
}
|
||||||
|
return this.parseBalance (result);
|
||||||
|
}
|
||||||
|
|
||||||
parseOrderStatus (status) {
|
parseOrderStatus (status) {
|
||||||
const statuses = {
|
const statuses = {
|
||||||
// basic orders
|
// basic orders
|
||||||
@@ -1166,6 +1153,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
}
|
}
|
||||||
const timeInForce = this.parseTimeInForce (this.safeString (order, 'time_in_force'));
|
const timeInForce = this.parseTimeInForce (this.safeString (order, 'time_in_force'));
|
||||||
const stopPrice = this.safeFloat (order, 'stop_px');
|
const stopPrice = this.safeFloat (order, 'stop_px');
|
||||||
|
const postOnly = (timeInForce === 'PO');
|
||||||
return {
|
return {
|
||||||
'info': order,
|
'info': order,
|
||||||
'id': id,
|
'id': id,
|
||||||
@@ -1176,6 +1164,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': timeInForce,
|
'timeInForce': timeInForce,
|
||||||
|
'postOnly': postOnly,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': stopPrice,
|
'stopPrice': stopPrice,
|
||||||
@@ -1192,7 +1181,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
|
|
||||||
async fetchOrder (id, symbol = undefined, params = {}) {
|
async fetchOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -1206,7 +1195,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
};
|
};
|
||||||
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
||||||
const marketType = this.safeString (marketTypes, symbol);
|
const marketType = this.safeString (marketTypes, symbol);
|
||||||
let method = (marketType === 'linear') ? 'privateLinearGetOrderSearch' : 'privateGetOrder';
|
let method = (marketType === 'linear') ? 'privateLinearGetOrderSearch' : 'v2PrivateGetOrder';
|
||||||
const stopOrderId = this.safeString (params, 'stop_order_id');
|
const stopOrderId = this.safeString (params, 'stop_order_id');
|
||||||
if (stopOrderId === undefined) {
|
if (stopOrderId === undefined) {
|
||||||
const orderLinkId = this.safeString (params, 'order_link_id');
|
const orderLinkId = this.safeString (params, 'order_link_id');
|
||||||
@@ -1214,7 +1203,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
request['order_id'] = id;
|
request['order_id'] = id;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
method = (marketType === 'linear') ? 'privateLinearGetStopOrderSearch' : 'privateGetStopOrder';
|
method = (marketType === 'linear') ? 'privateLinearGetStopOrderSearch' : 'v2PrivateGetStopOrder';
|
||||||
}
|
}
|
||||||
const response = await this[method] (this.extend (request, params));
|
const response = await this[method] (this.extend (request, params));
|
||||||
//
|
//
|
||||||
@@ -1327,7 +1316,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
if (price !== undefined) {
|
if (price !== undefined) {
|
||||||
request['price'] = parseFloat (this.priceToPrecision (symbol, price));
|
request['price'] = parseFloat (this.priceToPrecision (symbol, price));
|
||||||
} else {
|
} else {
|
||||||
throw new ArgumentsRequired (this.id + ' createOrder requires a price argument for a ' + type + ' order');
|
throw new ArgumentsRequired (this.id + ' createOrder() requires a price argument for a ' + type + ' order');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const clientOrderId = this.safeString2 (params, 'order_link_id', 'clientOrderId');
|
const clientOrderId = this.safeString2 (params, 'order_link_id', 'clientOrderId');
|
||||||
@@ -1339,7 +1328,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
const basePrice = this.safeValue (params, 'base_price');
|
const basePrice = this.safeValue (params, 'base_price');
|
||||||
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
||||||
const marketType = this.safeString (marketTypes, symbol);
|
const marketType = this.safeString (marketTypes, symbol);
|
||||||
let method = (marketType === 'linear') ? 'privateLinearPostOrderCreate' : 'privatePostOrderCreate';
|
let method = (marketType === 'linear') ? 'privateLinearPostOrderCreate' : 'v2PrivatePostOrderCreate';
|
||||||
if (marketType === 'linear') {
|
if (marketType === 'linear') {
|
||||||
method = 'privateLinearPostOrderCreate';
|
method = 'privateLinearPostOrderCreate';
|
||||||
request['reduce_only'] = false;
|
request['reduce_only'] = false;
|
||||||
@@ -1347,15 +1336,15 @@ module.exports = class bybit extends Exchange {
|
|||||||
}
|
}
|
||||||
if (stopPx !== undefined) {
|
if (stopPx !== undefined) {
|
||||||
if (basePrice === undefined) {
|
if (basePrice === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' createOrder requires both the stop_px and base_price params for a conditional ' + type + ' order');
|
throw new ArgumentsRequired (this.id + ' createOrder() requires both the stop_px and base_price params for a conditional ' + type + ' order');
|
||||||
} else {
|
} else {
|
||||||
method = (marketType === 'linear') ? 'privateLinearPostStopOrderCreate' : 'openapiPostStopOrderCreate';
|
method = (marketType === 'linear') ? 'privateLinearPostStopOrderCreate' : 'v2PrivatePostStopOrderCreate';
|
||||||
request['stop_px'] = parseFloat (this.priceToPrecision (symbol, stopPx));
|
request['stop_px'] = parseFloat (this.priceToPrecision (symbol, stopPx));
|
||||||
request['base_price'] = parseFloat (this.priceToPrecision (symbol, basePrice));
|
request['base_price'] = parseFloat (this.priceToPrecision (symbol, basePrice));
|
||||||
params = this.omit (params, [ 'stop_px', 'stopPrice', 'base_price' ]);
|
params = this.omit (params, [ 'stop_px', 'stopPrice', 'base_price' ]);
|
||||||
}
|
}
|
||||||
} else if (basePrice !== undefined) {
|
} else if (basePrice !== undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' createOrder requires both the stop_px and base_price params for a conditional ' + type + ' order');
|
throw new ArgumentsRequired (this.id + ' createOrder() requires both the stop_px and base_price params for a conditional ' + type + ' order');
|
||||||
}
|
}
|
||||||
const response = await this[method] (this.extend (request, params));
|
const response = await this[method] (this.extend (request, params));
|
||||||
//
|
//
|
||||||
@@ -1441,7 +1430,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
|
|
||||||
async editOrder (id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
async editOrder (id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' editOrder requires an symbol argument');
|
throw new ArgumentsRequired (this.id + ' editOrder() requires an symbol argument');
|
||||||
}
|
}
|
||||||
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
||||||
const marketType = this.safeString (marketTypes, symbol);
|
const marketType = this.safeString (marketTypes, symbol);
|
||||||
@@ -1457,17 +1446,23 @@ module.exports = class bybit extends Exchange {
|
|||||||
// 'stop_order_id': id, // only for conditional orders
|
// 'stop_order_id': id, // only for conditional orders
|
||||||
// 'p_r_trigger_price': 123.45, // new trigger price also known as stop_px
|
// 'p_r_trigger_price': 123.45, // new trigger price also known as stop_px
|
||||||
};
|
};
|
||||||
let method = (marketType === 'linear') ? 'privateLinearPostOrderReplace' : 'openapiPostOrderReplace';
|
let method = (marketType === 'linear') ? 'privateLinearPostOrderReplace' : 'v2PrivatePostOrderReplace';
|
||||||
const stopOrderId = this.safeString (params, 'stop_order_id');
|
const stopOrderId = this.safeString (params, 'stop_order_id');
|
||||||
if (stopOrderId !== undefined) {
|
if (stopOrderId !== undefined) {
|
||||||
method = (marketType === 'linear') ? 'privateLinearPostStopOrderReplace' : 'openapiPostStopOrderReplace';
|
method = (marketType === 'linear') ? 'privateLinearPostStopOrderReplace' : 'v2PrivatePostStopOrderReplace';
|
||||||
request['stop_order_id'] = stopOrderId;
|
request['stop_order_id'] = stopOrderId;
|
||||||
params = this.omit (params, [ 'stop_order_id' ]);
|
params = this.omit (params, [ 'stop_order_id' ]);
|
||||||
} else {
|
} else {
|
||||||
request['order_id'] = id;
|
request['order_id'] = id;
|
||||||
}
|
}
|
||||||
if (amount !== undefined) {
|
if (amount !== undefined) {
|
||||||
request['p_r_qty'] = parseInt (this.amountToPrecision (symbol, amount));
|
let qty = this.amountToPrecision (symbol, amount);
|
||||||
|
if (market['inverse']) {
|
||||||
|
qty = parseInt (qty);
|
||||||
|
} else {
|
||||||
|
qty = parseFloat (qty);
|
||||||
|
}
|
||||||
|
request['p_r_qty'] = qty;
|
||||||
}
|
}
|
||||||
if (price !== undefined) {
|
if (price !== undefined) {
|
||||||
request['p_r_price'] = parseFloat (this.priceToPrecision (symbol, price));
|
request['p_r_price'] = parseFloat (this.priceToPrecision (symbol, price));
|
||||||
@@ -1510,7 +1505,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -1524,7 +1519,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
};
|
};
|
||||||
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
||||||
const marketType = this.safeValue (marketTypes, symbol);
|
const marketType = this.safeValue (marketTypes, symbol);
|
||||||
let method = (marketType === 'linear') ? 'privateLinearPostOrderCancel' : 'privatePostOrderCancel';
|
let method = (marketType === 'linear') ? 'privateLinearPostOrderCancel' : 'v2PrivatePostOrderCancel';
|
||||||
const stopOrderId = this.safeString (params, 'stop_order_id');
|
const stopOrderId = this.safeString (params, 'stop_order_id');
|
||||||
if (stopOrderId === undefined) {
|
if (stopOrderId === undefined) {
|
||||||
const orderLinkId = this.safeString (params, 'order_link_id');
|
const orderLinkId = this.safeString (params, 'order_link_id');
|
||||||
@@ -1532,7 +1527,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
request['order_id'] = id;
|
request['order_id'] = id;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
method = (marketType === 'linear') ? 'privateLinearPostStopOrderCancel' : 'openapiPostStopOrderCancel';
|
method = (marketType === 'linear') ? 'privateLinearPostStopOrderCancel' : 'v2PrivatePostStopOrderCancel';
|
||||||
}
|
}
|
||||||
const response = await this[method] (this.extend (request, params));
|
const response = await this[method] (this.extend (request, params));
|
||||||
const result = this.safeValue (response, 'result', {});
|
const result = this.safeValue (response, 'result', {});
|
||||||
@@ -1541,17 +1536,17 @@ module.exports = class bybit extends Exchange {
|
|||||||
|
|
||||||
async cancelAllOrders (symbol = undefined, params = {}) {
|
async cancelAllOrders (symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelAllOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelAllOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
const request = {
|
const request = {
|
||||||
'symbol': market['id'],
|
'symbol': market['id'],
|
||||||
};
|
};
|
||||||
const options = this.safeValue (this.options, 'cancelAllOrders');
|
const options = this.safeValue (this.options, 'cancelAllOrders', {});
|
||||||
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
||||||
const marketType = this.safeString (marketTypes, symbol);
|
const marketType = this.safeString (marketTypes, symbol);
|
||||||
const defaultMethod = (marketType === 'linear') ? 'privateLinearPostOrderCancelAll' : 'privatePostOrderCancelAll';
|
const defaultMethod = (marketType === 'linear') ? 'privateLinearPostOrderCancelAll' : 'v2PrivatePostOrderCancelAll';
|
||||||
const method = this.safeString (options, 'method', defaultMethod);
|
const method = this.safeString (options, 'method', defaultMethod);
|
||||||
const response = await this[method] (this.extend (request, params));
|
const response = await this[method] (this.extend (request, params));
|
||||||
const result = this.safeValue (response, 'result', []);
|
const result = this.safeValue (response, 'result', []);
|
||||||
@@ -1583,7 +1578,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
const options = this.safeValue (this.options, 'fetchOrders', {});
|
const options = this.safeValue (this.options, 'fetchOrders', {});
|
||||||
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
||||||
const marketType = this.safeString (marketTypes, symbol);
|
const marketType = this.safeString (marketTypes, symbol);
|
||||||
let defaultMethod = (marketType === 'linear') ? 'privateLinearGetOrderList' : 'openapiGetOrderList';
|
let defaultMethod = (marketType === 'linear') ? 'privateLinearGetOrderList' : 'v2PrivateGetOrderList';
|
||||||
let query = params;
|
let query = params;
|
||||||
if (('stop_order_id' in params) || ('stop_order_status' in params)) {
|
if (('stop_order_id' in params) || ('stop_order_status' in params)) {
|
||||||
let stopOrderStatus = this.safeValue (params, 'stopOrderStatus');
|
let stopOrderStatus = this.safeValue (params, 'stopOrderStatus');
|
||||||
@@ -1594,7 +1589,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
request['stop_order_status'] = stopOrderStatus;
|
request['stop_order_status'] = stopOrderStatus;
|
||||||
query = this.omit (params, 'stop_order_status');
|
query = this.omit (params, 'stop_order_status');
|
||||||
}
|
}
|
||||||
defaultMethod = (marketType === 'linear') ? 'privateLinearGetStopOrderList' : 'openapiGetStopOrderList';
|
defaultMethod = (marketType === 'linear') ? 'privateLinearGetStopOrderList' : 'v2PrivateGetStopOrderList';
|
||||||
}
|
}
|
||||||
const method = this.safeString (options, 'method', defaultMethod);
|
const method = this.safeString (options, 'method', defaultMethod);
|
||||||
const response = await this[method] (this.extend (request, query));
|
const response = await this[method] (this.extend (request, query));
|
||||||
@@ -1760,7 +1755,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
const orderId = this.safeString (params, 'order_id');
|
const orderId = this.safeString (params, 'order_id');
|
||||||
if (orderId === undefined) {
|
if (orderId === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a symbol argument or an order_id param');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a symbol argument or an order_id param');
|
||||||
} else {
|
} else {
|
||||||
request['order_id'] = orderId;
|
request['order_id'] = orderId;
|
||||||
params = this.omit (params, 'order_id');
|
params = this.omit (params, 'order_id');
|
||||||
@@ -1777,7 +1772,7 @@ module.exports = class bybit extends Exchange {
|
|||||||
}
|
}
|
||||||
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
const marketTypes = this.safeValue (this.options, 'marketTypes', {});
|
||||||
const marketType = this.safeString (marketTypes, symbol);
|
const marketType = this.safeString (marketTypes, symbol);
|
||||||
const method = (marketType === 'linear') ? 'privateLinearGetTradeExecutionList' : 'privateGetExecutionList';
|
const method = (marketType === 'linear') ? 'privateLinearGetTradeExecutionList' : 'v2PrivateGetExecutionList';
|
||||||
const response = await this[method] (this.extend (request, params));
|
const response = await this[method] (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// inverse
|
// inverse
|
||||||
@@ -1867,41 +1862,60 @@ module.exports = class bybit extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchDeposits (code = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchDeposits (code = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (code === undefined) {
|
|
||||||
throw new ArgumentsRequired (this.id + ' fetchWithdrawals() requires a currency code argument');
|
|
||||||
}
|
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const currency = this.currency (code);
|
|
||||||
const request = {
|
const request = {
|
||||||
'currency': currency['id'],
|
// 'coin': currency['id'],
|
||||||
|
// 'currency': currency['id'], // alias
|
||||||
|
// 'start_date': this.iso8601 (since),
|
||||||
|
// 'end_date': this.iso8601 (till),
|
||||||
|
'wallet_fund_type': 'Deposit', // Deposit, Withdraw, RealisedPNL, Commission, Refund, Prize, ExchangeOrderWithdraw, ExchangeOrderDeposit
|
||||||
|
// 'page': 1,
|
||||||
|
// 'limit': 20, // max 50
|
||||||
};
|
};
|
||||||
if (limit !== undefined) {
|
let currency = undefined;
|
||||||
request['count'] = limit;
|
if (code !== undefined) {
|
||||||
|
currency = this.currency (code);
|
||||||
|
request['coin'] = currency['id'];
|
||||||
}
|
}
|
||||||
const response = await this.privateGetGetDeposits (this.extend (request, params));
|
if (since !== undefined) {
|
||||||
|
request['start_date'] = this.ymd (since);
|
||||||
|
}
|
||||||
|
if (limit !== undefined) {
|
||||||
|
request['limit'] = limit;
|
||||||
|
}
|
||||||
|
const response = await this.v2PrivateGetWalletFundRecords (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// "jsonrpc": "2.0",
|
// "ret_code": 0,
|
||||||
// "id": 5611,
|
// "ret_msg": "ok",
|
||||||
|
// "ext_code": "",
|
||||||
// "result": {
|
// "result": {
|
||||||
// "count": 1,
|
|
||||||
// "data": [
|
// "data": [
|
||||||
// {
|
// {
|
||||||
// "address": "2N35qDKDY22zmJq9eSyiAerMD4enJ1xx6ax",
|
// "id": 234467,
|
||||||
// "amount": 5,
|
// "user_id": 1,
|
||||||
// "currency": "BTC",
|
// "coin": "BTC",
|
||||||
// "received_timestamp": 1549295017670,
|
// "wallet_id": 27913,
|
||||||
// "state": "completed",
|
// "type": "Realized P&L",
|
||||||
// "transaction_id": "230669110fdaf0a0dbcdc079b6b8b43d5af29cc73683835b9bc6b3406c065fda",
|
// "amount": "-0.00000006",
|
||||||
// "updated_timestamp": 1549295130159
|
// "tx_id": "",
|
||||||
|
// "address": "BTCUSD",
|
||||||
|
// "wallet_balance": "0.03000330",
|
||||||
|
// "exec_time": "2019-12-09T00:00:25.000Z",
|
||||||
|
// "cross_seq": 0
|
||||||
// }
|
// }
|
||||||
// ]
|
// ]
|
||||||
// }
|
// },
|
||||||
|
// "ext_info": null,
|
||||||
|
// "time_now": "1577481867.115552",
|
||||||
|
// "rate_limit_status": 119,
|
||||||
|
// "rate_limit_reset_ms": 1577481867122,
|
||||||
|
// "rate_limit": 120
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
const result = this.safeValue (response, 'result', {});
|
const result = this.safeValue (response, 'result', {});
|
||||||
const data = this.safeValue (result, 'data', []);
|
const data = this.safeValue (result, 'data', []);
|
||||||
return this.parseTransactions (data, currency, since, limit, params);
|
return this.parseTransactions (data, currency, since, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
@@ -1920,12 +1934,12 @@ module.exports = class bybit extends Exchange {
|
|||||||
request['coin'] = currency['id'];
|
request['coin'] = currency['id'];
|
||||||
}
|
}
|
||||||
if (since !== undefined) {
|
if (since !== undefined) {
|
||||||
request['start_date'] = this.iso8601 (since);
|
request['start_date'] = this.ymd (since);
|
||||||
}
|
}
|
||||||
if (limit !== undefined) {
|
if (limit !== undefined) {
|
||||||
request['limit'] = limit;
|
request['limit'] = limit;
|
||||||
}
|
}
|
||||||
const response = await this.openapiGetWalletWithdrawList (this.extend (request, params));
|
const response = await this.v2PrivateGetWalletWithdrawList (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// "ret_code": 0,
|
// "ret_code": 0,
|
||||||
@@ -1991,9 +2005,25 @@ module.exports = class bybit extends Exchange {
|
|||||||
// "updated_at": "2019-06-11T02:20:24.000Z"
|
// "updated_at": "2019-06-11T02:20:24.000Z"
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
// fetchDeposits ledger entries
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "id": 234467,
|
||||||
|
// "user_id": 1,
|
||||||
|
// "coin": "BTC",
|
||||||
|
// "wallet_id": 27913,
|
||||||
|
// "type": "Realized P&L",
|
||||||
|
// "amount": "-0.00000006",
|
||||||
|
// "tx_id": "",
|
||||||
|
// "address": "BTCUSD",
|
||||||
|
// "wallet_balance": "0.03000330",
|
||||||
|
// "exec_time": "2019-12-09T00:00:25.000Z",
|
||||||
|
// "cross_seq": 0
|
||||||
|
// }
|
||||||
|
//
|
||||||
const currencyId = this.safeString (transaction, 'coin');
|
const currencyId = this.safeString (transaction, 'coin');
|
||||||
const code = this.safeCurrencyCode (currencyId, currency);
|
const code = this.safeCurrencyCode (currencyId, currency);
|
||||||
const timestamp = this.parse8601 (this.safeString (transaction, 'submited_at'));
|
const timestamp = this.parse8601 (this.safeString2 (transaction, 'submited_at', 'exec_time'));
|
||||||
const updated = this.parse8601 (this.safeString (transaction, 'updated_at'));
|
const updated = this.parse8601 (this.safeString (transaction, 'updated_at'));
|
||||||
const status = this.parseTransactionStatus (this.safeString (transaction, 'status'));
|
const status = this.parseTransactionStatus (this.safeString (transaction, 'status'));
|
||||||
const address = this.safeString (transaction, 'address');
|
const address = this.safeString (transaction, 'address');
|
||||||
@@ -2043,12 +2073,12 @@ module.exports = class bybit extends Exchange {
|
|||||||
request['coin'] = currency['id'];
|
request['coin'] = currency['id'];
|
||||||
}
|
}
|
||||||
if (since !== undefined) {
|
if (since !== undefined) {
|
||||||
request['start_date'] = this.iso8601 (since);
|
request['start_date'] = this.ymd (since);
|
||||||
}
|
}
|
||||||
if (limit !== undefined) {
|
if (limit !== undefined) {
|
||||||
request['limit'] = limit;
|
request['limit'] = limit;
|
||||||
}
|
}
|
||||||
const response = await this.openapiGetWalletFundRecords (this.extend (request, params));
|
const response = await this.v2PrivateGetWalletFundRecords (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// "ret_code": 0,
|
// "ret_code": 0,
|
||||||
@@ -2147,45 +2177,28 @@ module.exports = class bybit extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
||||||
let url = this.urls['api'];
|
let url = this.implodeParams (this.urls['api'], { 'hostname': this.hostname });
|
||||||
let request = path;
|
const type = this.safeString (api, 0);
|
||||||
|
const section = this.safeString (api, 1);
|
||||||
|
let request = '/' + type + '/' + section + '/' + path;
|
||||||
// public v2
|
// public v2
|
||||||
if (api === 'public') {
|
if (section === 'public') {
|
||||||
request = '/' + this.version + '/' + api + '/' + request;
|
|
||||||
if (Object.keys (params).length) {
|
if (Object.keys (params).length) {
|
||||||
request += '?' + this.rawencode (params);
|
request += '?' + this.rawencode (params);
|
||||||
}
|
}
|
||||||
} else if (api === 'publicLinear') {
|
} else if (type === 'public') {
|
||||||
request = '/public/linear/' + request;
|
|
||||||
if (Object.keys (params).length) {
|
if (Object.keys (params).length) {
|
||||||
request += '?' + this.rawencode (params);
|
request += '?' + this.rawencode (params);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.checkRequiredCredentials ();
|
this.checkRequiredCredentials ();
|
||||||
if (api === 'openapi') {
|
|
||||||
request = '/open-api/' + request;
|
|
||||||
} else if (api === 'private') {
|
|
||||||
// private v2
|
|
||||||
request = '/' + this.version + '/' + api + '/' + request;
|
|
||||||
} else if (api === 'privateLinear') {
|
|
||||||
request = '/private/linear/' + request;
|
|
||||||
} else {
|
|
||||||
// position, user
|
|
||||||
request = '/' + api + '/' + request;
|
|
||||||
}
|
|
||||||
const timestamp = this.nonce ();
|
const timestamp = this.nonce ();
|
||||||
const query = this.extend (params, {
|
const query = this.extend (params, {
|
||||||
'api_key': this.apiKey,
|
'api_key': this.apiKey,
|
||||||
'recv_window': this.options['recvWindow'],
|
'recv_window': this.options['recvWindow'],
|
||||||
'timestamp': timestamp,
|
'timestamp': timestamp,
|
||||||
});
|
});
|
||||||
let auth = this.rawencode (this.keysort (query));
|
const auth = this.rawencode (this.keysort (query));
|
||||||
// https://github.com/ccxt/ccxt/issues/7377
|
|
||||||
// https://github.com/ccxt/ccxt/issues/7515
|
|
||||||
// bybit encodes whole floats as integers without .0 for conditional stop-orders only
|
|
||||||
if (path.indexOf ('stop-order') >= 0) {
|
|
||||||
auth = auth.replace ('.0&', '&');
|
|
||||||
}
|
|
||||||
const signature = this.hmac (this.encode (auth), this.encode (this.secret));
|
const signature = this.hmac (this.encode (auth), this.encode (this.secret));
|
||||||
if (method === 'POST') {
|
if (method === 'POST') {
|
||||||
body = this.json (this.extend (query, {
|
body = this.json (this.extend (query, {
|
||||||
|
|||||||
Generated
Vendored
+15
-14
@@ -285,7 +285,7 @@ module.exports = class bytetrade extends Exchange {
|
|||||||
|
|
||||||
async fetchBalance (params = {}) {
|
async fetchBalance (params = {}) {
|
||||||
if (!('userid' in params) && (this.apiKey === undefined)) {
|
if (!('userid' in params) && (this.apiKey === undefined)) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchDeposits requires this.apiKey or userid argument');
|
throw new ArgumentsRequired (this.id + ' fetchDeposits() requires this.apiKey or userid argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {
|
const request = {
|
||||||
@@ -580,6 +580,7 @@ module.exports = class bytetrade extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -597,7 +598,7 @@ module.exports = class bytetrade extends Exchange {
|
|||||||
async createOrder (symbol, type, side, amount, price = undefined, params = {}) {
|
async createOrder (symbol, type, side, amount, price = undefined, params = {}) {
|
||||||
this.checkRequiredDependencies ();
|
this.checkRequiredDependencies ();
|
||||||
if (this.apiKey === undefined) {
|
if (this.apiKey === undefined) {
|
||||||
throw new ArgumentsRequired ('createOrder requires this.apiKey or userid in params');
|
throw new ArgumentsRequired ('createOrder() requires this.apiKey or userid in params');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -781,7 +782,7 @@ module.exports = class bytetrade extends Exchange {
|
|||||||
|
|
||||||
async fetchOrder (id, symbol = undefined, params = {}) {
|
async fetchOrder (id, symbol = undefined, params = {}) {
|
||||||
if (!('userid' in params) && (this.apiKey === undefined)) {
|
if (!('userid' in params) && (this.apiKey === undefined)) {
|
||||||
throw new ArgumentsRequired ('fetchOrder requires this.apiKey or userid argument');
|
throw new ArgumentsRequired ('fetchOrder() requires this.apiKey or userid argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {
|
const request = {
|
||||||
@@ -799,7 +800,7 @@ module.exports = class bytetrade extends Exchange {
|
|||||||
|
|
||||||
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (!('userid' in params) && (this.apiKey === undefined)) {
|
if (!('userid' in params) && (this.apiKey === undefined)) {
|
||||||
throw new ArgumentsRequired ('fetchOpenOrders requires this.apiKey or userid argument');
|
throw new ArgumentsRequired ('fetchOpenOrders() requires this.apiKey or userid argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {
|
const request = {
|
||||||
@@ -819,7 +820,7 @@ module.exports = class bytetrade extends Exchange {
|
|||||||
|
|
||||||
async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (!('userid' in params) && (this.apiKey === undefined)) {
|
if (!('userid' in params) && (this.apiKey === undefined)) {
|
||||||
throw new ArgumentsRequired ('fetchClosedOrders requires this.apiKey or userid argument');
|
throw new ArgumentsRequired ('fetchClosedOrders() requires this.apiKey or userid argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
let market = undefined;
|
let market = undefined;
|
||||||
@@ -839,7 +840,7 @@ module.exports = class bytetrade extends Exchange {
|
|||||||
|
|
||||||
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (!('userid' in params) && (this.apiKey === undefined)) {
|
if (!('userid' in params) && (this.apiKey === undefined)) {
|
||||||
throw new ArgumentsRequired ('fetchOrders requires this.apiKey or userid argument');
|
throw new ArgumentsRequired ('fetchOrders() requires this.apiKey or userid argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
let market = undefined;
|
let market = undefined;
|
||||||
@@ -859,10 +860,10 @@ module.exports = class bytetrade extends Exchange {
|
|||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
if (this.apiKey === undefined) {
|
if (this.apiKey === undefined) {
|
||||||
throw new ArgumentsRequired ('cancelOrder requires hasAlreadyAuthenticatedSuccessfully');
|
throw new ArgumentsRequired ('cancelOrder() requires hasAlreadyAuthenticatedSuccessfully');
|
||||||
}
|
}
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -960,7 +961,7 @@ module.exports = class bytetrade extends Exchange {
|
|||||||
async transfer (code, amount, address, message = '', params = {}) {
|
async transfer (code, amount, address, message = '', params = {}) {
|
||||||
this.checkRequiredDependencies ();
|
this.checkRequiredDependencies ();
|
||||||
if (this.apiKey === undefined) {
|
if (this.apiKey === undefined) {
|
||||||
throw new ArgumentsRequired ('transfer requires this.apiKey');
|
throw new ArgumentsRequired ('transfer() requires this.apiKey');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const currency = this.currency (code);
|
const currency = this.currency (code);
|
||||||
@@ -1066,7 +1067,7 @@ module.exports = class bytetrade extends Exchange {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (!('userid' in params) && (this.apiKey === undefined)) {
|
if (!('userid' in params) && (this.apiKey === undefined)) {
|
||||||
throw new ArgumentsRequired ('fetchMyTrades requires this.apiKey or userid argument');
|
throw new ArgumentsRequired ('fetchMyTrades() requires this.apiKey or userid argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -1086,7 +1087,7 @@ module.exports = class bytetrade extends Exchange {
|
|||||||
async fetchDeposits (code = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchDeposits (code = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
if (!('userid' in params) && (this.apiKey === undefined)) {
|
if (!('userid' in params) && (this.apiKey === undefined)) {
|
||||||
throw new ArgumentsRequired ('fetchDeposits requires this.apiKey or userid argument');
|
throw new ArgumentsRequired ('fetchDeposits() requires this.apiKey or userid argument');
|
||||||
}
|
}
|
||||||
let currency = undefined;
|
let currency = undefined;
|
||||||
const request = {
|
const request = {
|
||||||
@@ -1109,7 +1110,7 @@ module.exports = class bytetrade extends Exchange {
|
|||||||
async fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
if (!('userid' in params) && (this.apiKey === undefined)) {
|
if (!('userid' in params) && (this.apiKey === undefined)) {
|
||||||
throw new ArgumentsRequired ('fetchWithdrawals requires this.apiKey or userid argument');
|
throw new ArgumentsRequired ('fetchWithdrawals() requires this.apiKey or userid argument');
|
||||||
}
|
}
|
||||||
let currency = undefined;
|
let currency = undefined;
|
||||||
const request = {
|
const request = {
|
||||||
@@ -1193,7 +1194,7 @@ module.exports = class bytetrade extends Exchange {
|
|||||||
async fetchDepositAddress (code, params = {}) {
|
async fetchDepositAddress (code, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
if (!('userid' in params) && (this.apiKey === undefined)) {
|
if (!('userid' in params) && (this.apiKey === undefined)) {
|
||||||
throw new ArgumentsRequired ('fetchDepositAddress requires this.apiKey or userid argument');
|
throw new ArgumentsRequired ('fetchDepositAddress() requires this.apiKey or userid argument');
|
||||||
}
|
}
|
||||||
const currency = this.currency (code);
|
const currency = this.currency (code);
|
||||||
const request = {
|
const request = {
|
||||||
@@ -1219,7 +1220,7 @@ module.exports = class bytetrade extends Exchange {
|
|||||||
this.checkAddress (address);
|
this.checkAddress (address);
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
if (this.apiKey === undefined) {
|
if (this.apiKey === undefined) {
|
||||||
throw new ArgumentsRequired ('withdraw requires this.apiKey');
|
throw new ArgumentsRequired (this.id + ' withdraw() requires this.apiKey');
|
||||||
}
|
}
|
||||||
const addressResponse = await this.fetchDepositAddress (code);
|
const addressResponse = await this.fetchDepositAddress (code);
|
||||||
const chainTypeString = this.safeString (addressResponse, 'chainType');
|
const chainTypeString = this.safeString (addressResponse, 'chainType');
|
||||||
|
|||||||
+12
-10
@@ -6,25 +6,27 @@ const huobipro = require ('./huobipro.js');
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
module.exports = class huobiru extends huobipro {
|
module.exports = class cdax extends huobipro {
|
||||||
describe () {
|
describe () {
|
||||||
return this.deepExtend (super.describe (), {
|
return this.deepExtend (super.describe (), {
|
||||||
'id': 'huobiru',
|
'id': 'cdax',
|
||||||
'name': 'Huobi Russia',
|
'name': 'CDAX',
|
||||||
'countries': [ 'RU' ],
|
'countries': [ 'RU' ],
|
||||||
'hostname': 'www.huobi.com.ru',
|
'hostname': 'cdax.io',
|
||||||
'pro': true,
|
'pro': false,
|
||||||
'urls': {
|
'urls': {
|
||||||
'logo': 'https://user-images.githubusercontent.com/1294454/52978816-e8552e00-33e3-11e9-98ed-845acfece834.jpg',
|
'logo': 'https://user-images.githubusercontent.com/1294454/102157692-fd406280-3e90-11eb-8d46-4511b617cd17.jpg',
|
||||||
'api': {
|
'api': {
|
||||||
'market': 'https://{hostname}/api',
|
'market': 'https://{hostname}/api',
|
||||||
'public': 'https://{hostname}/api',
|
'public': 'https://{hostname}/api',
|
||||||
'private': 'https://{hostname}/api',
|
'private': 'https://{hostname}/api',
|
||||||
|
'v2Public': 'https://{hostname}/api',
|
||||||
|
'v2Private': 'https://{hostname}/api',
|
||||||
},
|
},
|
||||||
'www': 'https://www.huobi.com.ru/ru-ru',
|
'www': 'https://cdax.io',
|
||||||
'referral': 'https://www.huobi.com.ru/invite?invite_code=esc74',
|
'referral': 'https://cdax.io/invite?invite_code=esc74',
|
||||||
'doc': 'https://github.com/cloudapidoc/API_Docs_en',
|
'doc': 'https://github.com/cloudapidoc/API_Docs',
|
||||||
'fees': 'https://www.huobi.com.ru/ru-ru/about/fee/',
|
'fees': 'https://cdax.io/about/fee',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Generated
Vendored
+7
-7
@@ -676,10 +676,9 @@ module.exports = class cex extends Exchange {
|
|||||||
let cost = undefined;
|
let cost = undefined;
|
||||||
if (market !== undefined) {
|
if (market !== undefined) {
|
||||||
symbol = market['symbol'];
|
symbol = market['symbol'];
|
||||||
cost = this.safeFloat (order, 'ta:' + market['quote']);
|
const taCost = this.safeFloat (order, 'ta:' + market['quote']);
|
||||||
if (cost === undefined) {
|
const ttaCost = this.safeFloat (order, 'tta:' + market['quote']);
|
||||||
cost = this.safeFloat (order, 'tta:' + market['quote']);
|
cost = this.sum (taCost, ttaCost);
|
||||||
}
|
|
||||||
const baseFee = 'fa:' + market['base'];
|
const baseFee = 'fa:' + market['base'];
|
||||||
const baseTakerFee = 'tfa:' + market['base'];
|
const baseTakerFee = 'tfa:' + market['base'];
|
||||||
const quoteFee = 'fa:' + market['quote'];
|
const quoteFee = 'fa:' + market['quote'];
|
||||||
@@ -883,6 +882,7 @@ module.exports = class cex extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': (price === undefined) ? 'market' : 'limit',
|
'type': (price === undefined) ? 'market' : 'limit',
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -918,7 +918,7 @@ module.exports = class cex extends Exchange {
|
|||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const method = 'privatePostArchivedOrdersPair';
|
const method = 'privatePostArchivedOrdersPair';
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchClosedOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchClosedOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
const request = { 'pair': market['id'] };
|
const request = { 'pair': market['id'] };
|
||||||
@@ -1252,10 +1252,10 @@ module.exports = class cex extends Exchange {
|
|||||||
|
|
||||||
async editOrder (id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
async editOrder (id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
||||||
if (amount === undefined) {
|
if (amount === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' editOrder requires a amount argument');
|
throw new ArgumentsRequired (this.id + ' editOrder() requires a amount argument');
|
||||||
}
|
}
|
||||||
if (price === undefined) {
|
if (price === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' editOrder requires a price argument');
|
throw new ArgumentsRequired (this.id + ' editOrder() requires a price argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
|
|||||||
Generated
Vendored
+38
-22
@@ -3,7 +3,7 @@
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
const Exchange = require ('./base/Exchange');
|
const Exchange = require ('./base/Exchange');
|
||||||
const { ExchangeError, ArgumentsRequired, AuthenticationError, RateLimitExceeded } = require ('./base/errors');
|
const { ExchangeError, ArgumentsRequired, AuthenticationError, RateLimitExceeded, InvalidNonce } = require ('./base/errors');
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -123,23 +123,28 @@ module.exports = class coinbase extends Exchange {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
'exceptions': {
|
'exceptions': {
|
||||||
'two_factor_required': AuthenticationError, // 402 When sending money over 2fa limit
|
'exact': {
|
||||||
'param_required': ExchangeError, // 400 Missing parameter
|
'two_factor_required': AuthenticationError, // 402 When sending money over 2fa limit
|
||||||
'validation_error': ExchangeError, // 400 Unable to validate POST/PUT
|
'param_required': ExchangeError, // 400 Missing parameter
|
||||||
'invalid_request': ExchangeError, // 400 Invalid request
|
'validation_error': ExchangeError, // 400 Unable to validate POST/PUT
|
||||||
'personal_details_required': AuthenticationError, // 400 User’s personal detail required to complete this request
|
'invalid_request': ExchangeError, // 400 Invalid request
|
||||||
'identity_verification_required': AuthenticationError, // 400 Identity verification is required to complete this request
|
'personal_details_required': AuthenticationError, // 400 User’s personal detail required to complete this request
|
||||||
'jumio_verification_required': AuthenticationError, // 400 Document verification is required to complete this request
|
'identity_verification_required': AuthenticationError, // 400 Identity verification is required to complete this request
|
||||||
'jumio_face_match_verification_required': AuthenticationError, // 400 Document verification including face match is required to complete this request
|
'jumio_verification_required': AuthenticationError, // 400 Document verification is required to complete this request
|
||||||
'unverified_email': AuthenticationError, // 400 User has not verified their email
|
'jumio_face_match_verification_required': AuthenticationError, // 400 Document verification including face match is required to complete this request
|
||||||
'authentication_error': AuthenticationError, // 401 Invalid auth (generic)
|
'unverified_email': AuthenticationError, // 400 User has not verified their email
|
||||||
'invalid_token': AuthenticationError, // 401 Invalid Oauth token
|
'authentication_error': AuthenticationError, // 401 Invalid auth (generic)
|
||||||
'revoked_token': AuthenticationError, // 401 Revoked Oauth token
|
'invalid_token': AuthenticationError, // 401 Invalid Oauth token
|
||||||
'expired_token': AuthenticationError, // 401 Expired Oauth token
|
'revoked_token': AuthenticationError, // 401 Revoked Oauth token
|
||||||
'invalid_scope': AuthenticationError, // 403 User hasn’t authenticated necessary scope
|
'expired_token': AuthenticationError, // 401 Expired Oauth token
|
||||||
'not_found': ExchangeError, // 404 Resource not found
|
'invalid_scope': AuthenticationError, // 403 User hasn’t authenticated necessary scope
|
||||||
'rate_limit_exceeded': RateLimitExceeded, // 429 Rate limit exceeded
|
'not_found': ExchangeError, // 404 Resource not found
|
||||||
'internal_server_error': ExchangeError, // 500 Internal server error
|
'rate_limit_exceeded': RateLimitExceeded, // 429 Rate limit exceeded
|
||||||
|
'internal_server_error': ExchangeError, // 500 Internal server error
|
||||||
|
},
|
||||||
|
'broad': {
|
||||||
|
'request timestamp expired': InvalidNonce, // {"errors":[{"id":"authentication_error","message":"request timestamp expired"}]}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'commonCurrencies': {
|
'commonCurrencies': {
|
||||||
'CGLD': 'CELO',
|
'CGLD': 'CELO',
|
||||||
@@ -172,7 +177,11 @@ module.exports = class coinbase extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchAccounts (params = {}) {
|
async fetchAccounts (params = {}) {
|
||||||
const response = await this.privateGetAccounts (params);
|
await this.loadMarkets ();
|
||||||
|
const request = {
|
||||||
|
'limit': 100,
|
||||||
|
};
|
||||||
|
const response = await this.privateGetAccounts (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// "id": "XLM",
|
// "id": "XLM",
|
||||||
@@ -703,7 +712,10 @@ module.exports = class coinbase extends Exchange {
|
|||||||
|
|
||||||
async fetchBalance (params = {}) {
|
async fetchBalance (params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const response = await this.privateGetAccounts (params);
|
const request = {
|
||||||
|
'limit': 100,
|
||||||
|
};
|
||||||
|
const response = await this.privateGetAccounts (this.extend (request, params));
|
||||||
const balances = this.safeValue (response, 'data');
|
const balances = this.safeValue (response, 'data');
|
||||||
const accounts = this.safeValue (params, 'type', this.options['accounts']);
|
const accounts = this.safeValue (params, 'type', this.options['accounts']);
|
||||||
const result = { 'info': response };
|
const result = { 'info': response };
|
||||||
@@ -1175,7 +1187,9 @@ module.exports = class coinbase extends Exchange {
|
|||||||
//
|
//
|
||||||
let errorCode = this.safeString (response, 'error');
|
let errorCode = this.safeString (response, 'error');
|
||||||
if (errorCode !== undefined) {
|
if (errorCode !== undefined) {
|
||||||
this.throwExactlyMatchedException (this.exceptions, errorCode, feedback);
|
const errorMessage = this.safeString (response, 'error_description');
|
||||||
|
this.throwExactlyMatchedException (this.exceptions['exact'], errorCode, feedback);
|
||||||
|
this.throwBroadlyMatchedException (this.exceptions['broad'], errorMessage, feedback);
|
||||||
throw new ExchangeError (feedback);
|
throw new ExchangeError (feedback);
|
||||||
}
|
}
|
||||||
const errors = this.safeValue (response, 'errors');
|
const errors = this.safeValue (response, 'errors');
|
||||||
@@ -1184,8 +1198,10 @@ module.exports = class coinbase extends Exchange {
|
|||||||
const numErrors = errors.length;
|
const numErrors = errors.length;
|
||||||
if (numErrors > 0) {
|
if (numErrors > 0) {
|
||||||
errorCode = this.safeString (errors[0], 'id');
|
errorCode = this.safeString (errors[0], 'id');
|
||||||
|
const errorMessage = this.safeString (errors[0], 'message');
|
||||||
if (errorCode !== undefined) {
|
if (errorCode !== undefined) {
|
||||||
this.throwExactlyMatchedException (this.exceptions, errorCode, feedback);
|
this.throwExactlyMatchedException (this.exceptions['exact'], errorCode, feedback);
|
||||||
|
this.throwBroadlyMatchedException (this.exceptions['broad'], errorMessage, feedback);
|
||||||
throw new ExchangeError (feedback);
|
throw new ExchangeError (feedback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
Vendored
+173
-36
@@ -345,6 +345,7 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchAccounts (params = {}) {
|
async fetchAccounts (params = {}) {
|
||||||
|
await this.loadMarkets ();
|
||||||
const response = await this.privateGetAccounts (params);
|
const response = await this.privateGetAccounts (params);
|
||||||
//
|
//
|
||||||
// [
|
// [
|
||||||
@@ -523,12 +524,20 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
// trade_id: 82047307,
|
// trade_id: 82047307,
|
||||||
// maker_order_id: '0f358725-2134-435e-be11-753912a326e0',
|
// maker_order_id: '0f358725-2134-435e-be11-753912a326e0',
|
||||||
// taker_order_id: '252b7002-87a3-425c-ac73-f5b9e23f3caf',
|
// taker_order_id: '252b7002-87a3-425c-ac73-f5b9e23f3caf',
|
||||||
|
// order_id: 'd50ec984-77a8-460a-b958-66f114b0de9b',
|
||||||
// side: 'sell',
|
// side: 'sell',
|
||||||
// size: '0.00513192',
|
// size: '0.00513192',
|
||||||
// price: '9314.78',
|
// price: '9314.78',
|
||||||
// product_id: 'BTC-USD',
|
// product_id: 'BTC-USD',
|
||||||
|
// profile_id: '6244401d-c078-40d9-b305-7ad3551bc3b0',
|
||||||
// sequence: 12038915443,
|
// sequence: 12038915443,
|
||||||
// time: '2020-01-31T20:03:41.158814Z'
|
// time: '2020-01-31T20:03:41.158814Z'
|
||||||
|
// created_at: '2014-11-07T22:19:28.578544Z',
|
||||||
|
// liquidity: 'T',
|
||||||
|
// fee: '0.00025',
|
||||||
|
// settled: true,
|
||||||
|
// usd_volume: '0.0924556000000000',
|
||||||
|
// user_id: '595eb864313c2b02ddf2937d'
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
const timestamp = this.parse8601 (this.safeString2 (trade, 'time', 'created_at'));
|
const timestamp = this.parse8601 (this.safeString2 (trade, 'time', 'created_at'));
|
||||||
@@ -537,10 +546,15 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
let feeRate = undefined;
|
let feeRate = undefined;
|
||||||
let feeCurrency = undefined;
|
let feeCurrency = undefined;
|
||||||
let takerOrMaker = undefined;
|
let takerOrMaker = undefined;
|
||||||
|
let cost = undefined;
|
||||||
if (market !== undefined) {
|
if (market !== undefined) {
|
||||||
|
const feeCurrencyId = this.safeStringLower (market, 'quoteId');
|
||||||
|
const costField = feeCurrencyId + '_value';
|
||||||
|
cost = this.safeFloat (trade, costField);
|
||||||
feeCurrency = market['quote'];
|
feeCurrency = market['quote'];
|
||||||
if ('liquidity' in trade) {
|
const liquidity = this.safeString (trade, 'liquidity');
|
||||||
takerOrMaker = (trade['liquidity'] === 'T') ? 'taker' : 'maker';
|
if (liquidity !== undefined) {
|
||||||
|
takerOrMaker = (liquidity === 'T') ? 'taker' : 'maker';
|
||||||
feeRate = market[takerOrMaker];
|
feeRate = market[takerOrMaker];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -560,6 +574,9 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
}
|
}
|
||||||
const price = this.safeFloat (trade, 'price');
|
const price = this.safeFloat (trade, 'price');
|
||||||
const amount = this.safeFloat (trade, 'size');
|
const amount = this.safeFloat (trade, 'size');
|
||||||
|
if (cost === undefined) {
|
||||||
|
cost = amount * price;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
'id': id,
|
'id': id,
|
||||||
'order': orderId,
|
'order': orderId,
|
||||||
@@ -573,14 +590,14 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
'price': price,
|
'price': price,
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
'fee': fee,
|
'fee': fee,
|
||||||
'cost': price * amount,
|
'cost': cost,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
// as of 2018-08-23
|
// as of 2018-08-23
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -600,6 +617,9 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
const request = {
|
const request = {
|
||||||
'id': market['id'], // fixes issue #2
|
'id': market['id'], // fixes issue #2
|
||||||
};
|
};
|
||||||
|
if (limit !== undefined) {
|
||||||
|
request['limit'] = limit; // default 100
|
||||||
|
}
|
||||||
const response = await this.publicGetProductsIdTrades (this.extend (request, params));
|
const response = await this.publicGetProductsIdTrades (this.extend (request, params));
|
||||||
return this.parseTrades (response, market, since, limit);
|
return this.parseTrades (response, market, since, limit);
|
||||||
}
|
}
|
||||||
@@ -676,6 +696,27 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parseOrder (order, market = undefined) {
|
parseOrder (order, market = undefined) {
|
||||||
|
//
|
||||||
|
// createOrder
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "id": "d0c5340b-6d6c-49d9-b567-48c4bfca13d2",
|
||||||
|
// "price": "0.10000000",
|
||||||
|
// "size": "0.01000000",
|
||||||
|
// "product_id": "BTC-USD",
|
||||||
|
// "side": "buy",
|
||||||
|
// "stp": "dc",
|
||||||
|
// "type": "limit",
|
||||||
|
// "time_in_force": "GTC",
|
||||||
|
// "post_only": false,
|
||||||
|
// "created_at": "2016-12-08T20:02:28.53864Z",
|
||||||
|
// "fill_fees": "0.0000000000000000",
|
||||||
|
// "filled_size": "0.00000000",
|
||||||
|
// "executed_value": "0.0000000000000000",
|
||||||
|
// "status": "pending",
|
||||||
|
// "settled": false
|
||||||
|
// }
|
||||||
|
//
|
||||||
const timestamp = this.parse8601 (this.safeString (order, 'created_at'));
|
const timestamp = this.parse8601 (this.safeString (order, 'created_at'));
|
||||||
const marketId = this.safeString (order, 'product_id');
|
const marketId = this.safeString (order, 'product_id');
|
||||||
market = this.safeMarket (marketId, market, '-');
|
market = this.safeMarket (marketId, market, '-');
|
||||||
@@ -706,9 +747,13 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
const id = this.safeString (order, 'id');
|
const id = this.safeString (order, 'id');
|
||||||
const type = this.safeString (order, 'type');
|
const type = this.safeString (order, 'type');
|
||||||
const side = this.safeString (order, 'side');
|
const side = this.safeString (order, 'side');
|
||||||
|
const timeInForce = this.safeString (order, 'time_in_force');
|
||||||
|
const postOnly = this.safeValue (order, 'post_only');
|
||||||
|
const stopPrice = this.safeFloat (order, 'stop_price');
|
||||||
|
const clientOrderId = this.safeString (order, 'client_oid');
|
||||||
return {
|
return {
|
||||||
'id': id,
|
'id': id,
|
||||||
'clientOrderId': undefined,
|
'clientOrderId': clientOrderId,
|
||||||
'info': order,
|
'info': order,
|
||||||
'timestamp': timestamp,
|
'timestamp': timestamp,
|
||||||
'datetime': this.iso8601 (timestamp),
|
'datetime': this.iso8601 (timestamp),
|
||||||
@@ -716,10 +761,11 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
'status': status,
|
'status': status,
|
||||||
'symbol': market['symbol'],
|
'symbol': market['symbol'],
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': timeInForce,
|
||||||
|
'postOnly': postOnly,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': stopPrice,
|
||||||
'cost': cost,
|
'cost': cost,
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
'filled': filled,
|
'filled': filled,
|
||||||
@@ -732,10 +778,18 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
|
|
||||||
async fetchOrder (id, symbol = undefined, params = {}) {
|
async fetchOrder (id, symbol = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {
|
const request = {};
|
||||||
'id': id,
|
const clientOrderId = this.safeString2 (params, 'clientOrderId', 'client_oid');
|
||||||
};
|
let method = undefined;
|
||||||
const response = await this.privateGetOrdersId (this.extend (request, params));
|
if (clientOrderId === undefined) {
|
||||||
|
method = 'privateGetOrdersId';
|
||||||
|
request['id'] = id;
|
||||||
|
} else {
|
||||||
|
method = 'privateGetOrdersClientClientOid';
|
||||||
|
request['client_oid'] = clientOrderId;
|
||||||
|
params = this.omit (params, [ 'clientOrderId', 'client_oid' ]);
|
||||||
|
}
|
||||||
|
const response = await this[method] (this.extend (request, params));
|
||||||
return this.parseOrder (response);
|
return this.parseOrder (response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -753,17 +807,10 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
|
||||||
const request = {
|
const request = {
|
||||||
'status': 'all',
|
'status': 'all',
|
||||||
};
|
};
|
||||||
let market = undefined;
|
return await this.fetchOpenOrders (symbol, since, limit, this.extend (request, params));
|
||||||
if (symbol !== undefined) {
|
|
||||||
market = this.market (symbol);
|
|
||||||
request['product_id'] = market['id'];
|
|
||||||
}
|
|
||||||
const response = await this.privateGetOrders (this.extend (request, params));
|
|
||||||
return this.parseOrders (response, market, since, limit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
@@ -774,47 +821,131 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
market = this.market (symbol);
|
market = this.market (symbol);
|
||||||
request['product_id'] = market['id'];
|
request['product_id'] = market['id'];
|
||||||
}
|
}
|
||||||
|
if (limit !== undefined) {
|
||||||
|
request['limit'] = limit; // default 100
|
||||||
|
}
|
||||||
const response = await this.privateGetOrders (this.extend (request, params));
|
const response = await this.privateGetOrders (this.extend (request, params));
|
||||||
return this.parseOrders (response, market, since, limit);
|
return this.parseOrders (response, market, since, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
|
||||||
const request = {
|
const request = {
|
||||||
'status': 'done',
|
'status': 'done',
|
||||||
};
|
};
|
||||||
let market = undefined;
|
return await this.fetchOpenOrders (symbol, since, limit, this.extend (request, params));
|
||||||
if (symbol !== undefined) {
|
|
||||||
market = this.market (symbol);
|
|
||||||
request['product_id'] = market['id'];
|
|
||||||
}
|
|
||||||
const response = await this.privateGetOrders (this.extend (request, params));
|
|
||||||
return this.parseOrders (response, market, since, limit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async createOrder (symbol, type, side, amount, price = undefined, params = {}) {
|
async createOrder (symbol, type, side, amount, price = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
// let oid = this.nonce ().toString ();
|
const market = this.market (symbol);
|
||||||
const request = {
|
const request = {
|
||||||
'product_id': this.marketId (symbol),
|
// common params --------------------------------------------------
|
||||||
'side': side,
|
// 'client_oid': clientOrderId,
|
||||||
'size': this.amountToPrecision (symbol, amount),
|
|
||||||
'type': type,
|
'type': type,
|
||||||
|
'side': side,
|
||||||
|
'product_id': market['id'],
|
||||||
|
// 'size': this.amountToPrecision (symbol, amount),
|
||||||
|
// 'stp': 'dc', // self-trade prevention, dc = decrease and cancel, co = cancel oldest, cn = cancel newest, cb = cancel both
|
||||||
|
// 'stop': 'loss', // "loss" = stop loss below price, "entry" = take profit above price
|
||||||
|
// 'stop_price': this.priceToPrecision (symbol, price),
|
||||||
|
// limit order params ---------------------------------------------
|
||||||
|
// 'price': this.priceToPrecision (symbol, price),
|
||||||
|
// 'size': this.amountToPrecision (symbol, amount),
|
||||||
|
// 'time_in_force': 'GTC', // GTC, GTT, IOC, or FOK
|
||||||
|
// 'cancel_after' [optional]* min, hour, day, requires time_in_force to be GTT
|
||||||
|
// 'post_only': false, // invalid when time_in_force is IOC or FOK
|
||||||
|
// market order params --------------------------------------------
|
||||||
|
// 'size': this.amountToPrecision (symbol, amount),
|
||||||
|
// 'funds': this.costToPrecision (symbol, amount),
|
||||||
};
|
};
|
||||||
|
const clientOrderId = this.safeString2 (params, 'clientOrderId', 'client_oid');
|
||||||
|
if (clientOrderId !== undefined) {
|
||||||
|
request['client_oid'] = clientOrderId;
|
||||||
|
params = this.omit (params, [ 'clientOrderId', 'client_oid' ]);
|
||||||
|
}
|
||||||
|
const stopPrice = this.safeFloat2 (params, 'stopPrice', 'stop_price');
|
||||||
|
if (stopPrice !== undefined) {
|
||||||
|
request['stop_price'] = this.priceToPrecision (symbol, stopPrice);
|
||||||
|
params = this.omit (params, [ 'stopPrice', 'stop_price' ]);
|
||||||
|
}
|
||||||
|
const timeInForce = this.safeString2 (params, 'timeInForce', 'time_in_force');
|
||||||
|
if (timeInForce !== undefined) {
|
||||||
|
request['time_in_force'] = timeInForce;
|
||||||
|
params = this.omit (params, [ 'timeInForce', 'time_in_force' ]);
|
||||||
|
}
|
||||||
if (type === 'limit') {
|
if (type === 'limit') {
|
||||||
request['price'] = this.priceToPrecision (symbol, price);
|
request['price'] = this.priceToPrecision (symbol, price);
|
||||||
|
request['size'] = this.amountToPrecision (symbol, amount);
|
||||||
|
} else if (type === 'market') {
|
||||||
|
let cost = this.safeFloat2 (params, 'cost', 'funds');
|
||||||
|
if (cost === undefined) {
|
||||||
|
if (price !== undefined) {
|
||||||
|
cost = amount * price;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
params = this.omit (params, [ 'cost', 'funds' ]);
|
||||||
|
}
|
||||||
|
if (cost !== undefined) {
|
||||||
|
request['funds'] = this.costToPrecision (symbol, cost);
|
||||||
|
} else {
|
||||||
|
request['size'] = this.amountToPrecision (symbol, amount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const response = await this.privatePostOrders (this.extend (request, params));
|
const response = await this.privatePostOrders (this.extend (request, params));
|
||||||
return this.parseOrder (response);
|
//
|
||||||
|
// {
|
||||||
|
// "id": "d0c5340b-6d6c-49d9-b567-48c4bfca13d2",
|
||||||
|
// "price": "0.10000000",
|
||||||
|
// "size": "0.01000000",
|
||||||
|
// "product_id": "BTC-USD",
|
||||||
|
// "side": "buy",
|
||||||
|
// "stp": "dc",
|
||||||
|
// "type": "limit",
|
||||||
|
// "time_in_force": "GTC",
|
||||||
|
// "post_only": false,
|
||||||
|
// "created_at": "2016-12-08T20:02:28.53864Z",
|
||||||
|
// "fill_fees": "0.0000000000000000",
|
||||||
|
// "filled_size": "0.00000000",
|
||||||
|
// "executed_value": "0.0000000000000000",
|
||||||
|
// "status": "pending",
|
||||||
|
// "settled": false
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
return this.parseOrder (response, market);
|
||||||
}
|
}
|
||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
return await this.privateDeleteOrdersId ({ 'id': id });
|
const request = {
|
||||||
|
// 'product_id': market['id'], // the request will be more performant if you include it
|
||||||
|
};
|
||||||
|
const clientOrderId = this.safeString2 (params, 'clientOrderId', 'client_oid');
|
||||||
|
let method = undefined;
|
||||||
|
if (clientOrderId === undefined) {
|
||||||
|
method = 'privateDeleteOrdersId';
|
||||||
|
request['id'] = id;
|
||||||
|
} else {
|
||||||
|
method = 'privateDeleteOrdersClientClientOid';
|
||||||
|
request['client_oid'] = clientOrderId;
|
||||||
|
params = this.omit (params, [ 'clientOrderId', 'client_oid' ]);
|
||||||
|
}
|
||||||
|
let market = undefined;
|
||||||
|
if (symbol !== undefined) {
|
||||||
|
market = this.market (symbol);
|
||||||
|
request['product_id'] = market['symbol']; // the request will be more performant if you include it
|
||||||
|
}
|
||||||
|
return await this[method] (this.extend (request, params));
|
||||||
}
|
}
|
||||||
|
|
||||||
async cancelAllOrders (symbol = undefined, params = {}) {
|
async cancelAllOrders (symbol = undefined, params = {}) {
|
||||||
return await this.privateDeleteOrders (params);
|
await this.loadMarkets ();
|
||||||
|
const request = {};
|
||||||
|
let market = undefined;
|
||||||
|
if (symbol !== undefined) {
|
||||||
|
market = this.market (symbol);
|
||||||
|
request['product_id'] = market['symbol']; // the request will be more performant if you include it
|
||||||
|
}
|
||||||
|
return await this.privateDeleteOrders (this.extend (request, params));
|
||||||
}
|
}
|
||||||
|
|
||||||
calculateFee (symbol, type, side, amount, price, takerOrMaker = 'taker', params = {}) {
|
calculateFee (symbol, type, side, amount, price, takerOrMaker = 'taker', params = {}) {
|
||||||
@@ -880,6 +1011,9 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
} else {
|
} else {
|
||||||
method += 'Crypto';
|
method += 'Crypto';
|
||||||
request['crypto_address'] = address;
|
request['crypto_address'] = address;
|
||||||
|
if (tag !== undefined) {
|
||||||
|
request['destination_tag'] = tag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const response = await this[method] (this.extend (request, params));
|
const response = await this[method] (this.extend (request, params));
|
||||||
if (!response) {
|
if (!response) {
|
||||||
@@ -965,7 +1099,7 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
const currencyId = this.safeString (transaction, 'currency');
|
const currencyId = this.safeString (transaction, 'currency');
|
||||||
const code = this.safeCurrencyCode (currencyId, currency);
|
const code = this.safeCurrencyCode (currencyId, currency);
|
||||||
const status = this.parseTransactionStatus (transaction);
|
const status = this.parseTransactionStatus (transaction);
|
||||||
const amount = this.safeFloat (transaction, 'amount');
|
let amount = this.safeFloat (transaction, 'amount');
|
||||||
let type = this.safeString (transaction, 'type');
|
let type = this.safeString (transaction, 'type');
|
||||||
let address = this.safeString (details, 'crypto_address');
|
let address = this.safeString (details, 'crypto_address');
|
||||||
const tag = this.safeString (details, 'destination_tag');
|
const tag = this.safeString (details, 'destination_tag');
|
||||||
@@ -976,9 +1110,12 @@ module.exports = class coinbasepro extends Exchange {
|
|||||||
address = this.safeString (details, 'sent_to_address', address);
|
address = this.safeString (details, 'sent_to_address', address);
|
||||||
const feeCost = this.safeFloat (details, 'fee');
|
const feeCost = this.safeFloat (details, 'fee');
|
||||||
if (feeCost !== undefined) {
|
if (feeCost !== undefined) {
|
||||||
|
if (amount !== undefined) {
|
||||||
|
amount -= feeCost;
|
||||||
|
}
|
||||||
fee = {
|
fee = {
|
||||||
'cost': feeCost,
|
'cost': feeCost,
|
||||||
'code': code,
|
'currency': code,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
Vendored
+1
@@ -197,6 +197,7 @@ module.exports = class coincheck extends Exchange {
|
|||||||
'side': side,
|
'side': side,
|
||||||
'type': undefined,
|
'type': undefined,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'status': status,
|
'status': status,
|
||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'price': price,
|
'price': price,
|
||||||
|
|||||||
Generated
Vendored
+2
@@ -154,6 +154,7 @@ module.exports = class coinegg extends Exchange {
|
|||||||
},
|
},
|
||||||
'commonCurrencies': {
|
'commonCurrencies': {
|
||||||
'JBC': 'JubaoCoin',
|
'JBC': 'JubaoCoin',
|
||||||
|
'SBTC': 'Super Bitcoin',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -367,6 +368,7 @@ module.exports = class coinegg extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+12
-5
@@ -92,6 +92,8 @@ module.exports = class coinex extends Exchange {
|
|||||||
'order/status',
|
'order/status',
|
||||||
'order/status/batch',
|
'order/status/batch',
|
||||||
'order/user/deals',
|
'order/user/deals',
|
||||||
|
'sub_account/balance',
|
||||||
|
'sub_account/transfer/history',
|
||||||
],
|
],
|
||||||
'post': [
|
'post': [
|
||||||
'balance/coin/withdraw',
|
'balance/coin/withdraw',
|
||||||
@@ -499,6 +501,7 @@ module.exports = class coinex extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -562,7 +565,7 @@ module.exports = class coinex extends Exchange {
|
|||||||
|
|
||||||
async fetchOrder (id, symbol = undefined, params = {}) {
|
async fetchOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -759,7 +762,7 @@ module.exports = class coinex extends Exchange {
|
|||||||
const timestamp = this.safeTimestamp (transaction, 'create_time');
|
const timestamp = this.safeTimestamp (transaction, 'create_time');
|
||||||
const type = ('coin_withdraw_id' in transaction) ? 'withdraw' : 'deposit';
|
const type = ('coin_withdraw_id' in transaction) ? 'withdraw' : 'deposit';
|
||||||
const status = this.parseTransactionStatus (this.safeString (transaction, 'status'));
|
const status = this.parseTransactionStatus (this.safeString (transaction, 'status'));
|
||||||
const amount = this.safeFloat (transaction, 'amount');
|
let amount = this.safeFloat (transaction, 'amount');
|
||||||
let feeCost = this.safeFloat (transaction, 'tx_fee');
|
let feeCost = this.safeFloat (transaction, 'tx_fee');
|
||||||
if (type === 'deposit') {
|
if (type === 'deposit') {
|
||||||
feeCost = 0;
|
feeCost = 0;
|
||||||
@@ -768,6 +771,10 @@ module.exports = class coinex extends Exchange {
|
|||||||
'cost': feeCost,
|
'cost': feeCost,
|
||||||
'currency': code,
|
'currency': code,
|
||||||
};
|
};
|
||||||
|
// https://github.com/ccxt/ccxt/issues/8321
|
||||||
|
if (amount !== undefined) {
|
||||||
|
amount = amount - feeCost;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
'info': transaction,
|
'info': transaction,
|
||||||
'id': id,
|
'id': id,
|
||||||
@@ -787,7 +794,7 @@ module.exports = class coinex extends Exchange {
|
|||||||
|
|
||||||
async fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (code === undefined) {
|
if (code === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchWithdrawals requires a currency code argument');
|
throw new ArgumentsRequired (this.id + ' fetchWithdrawals() requires a currency code argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const currency = this.currency (code);
|
const currency = this.currency (code);
|
||||||
@@ -845,7 +852,7 @@ module.exports = class coinex extends Exchange {
|
|||||||
|
|
||||||
async fetchDeposits (code = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchDeposits (code = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (code === undefined) {
|
if (code === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchDeposits requires a currency code argument');
|
throw new ArgumentsRequired (this.id + ' fetchDeposits() requires a currency code argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const currency = this.currency (code);
|
const currency = this.currency (code);
|
||||||
@@ -910,7 +917,7 @@ module.exports = class coinex extends Exchange {
|
|||||||
'tonce': nonce.toString (),
|
'tonce': nonce.toString (),
|
||||||
}, query);
|
}, query);
|
||||||
query = this.keysort (query);
|
query = this.keysort (query);
|
||||||
const urlencoded = this.urlencode (query);
|
const urlencoded = this.rawencode (query);
|
||||||
const signature = this.hash (this.encode (urlencoded + '&secret_key=' + this.secret));
|
const signature = this.hash (this.encode (urlencoded + '&secret_key=' + this.secret));
|
||||||
headers = {
|
headers = {
|
||||||
'Authorization': signature.toUpperCase (),
|
'Authorization': signature.toUpperCase (),
|
||||||
|
|||||||
Generated
Vendored
+3
-1
@@ -217,7 +217,7 @@ module.exports = class coinfalcon extends Exchange {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -320,6 +320,7 @@ module.exports = class coinfalcon extends Exchange {
|
|||||||
type = type[0];
|
type = type[0];
|
||||||
}
|
}
|
||||||
const side = this.safeString (order, 'order_type');
|
const side = this.safeString (order, 'order_type');
|
||||||
|
const postOnly = this.safeValue (order, 'post_only');
|
||||||
return {
|
return {
|
||||||
'id': this.safeString (order, 'id'),
|
'id': this.safeString (order, 'id'),
|
||||||
'clientOrderId': undefined,
|
'clientOrderId': undefined,
|
||||||
@@ -329,6 +330,7 @@ module.exports = class coinfalcon extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': postOnly,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+6
-5
@@ -27,7 +27,7 @@ module.exports = class coinfloor extends Exchange {
|
|||||||
},
|
},
|
||||||
'urls': {
|
'urls': {
|
||||||
'logo': 'https://user-images.githubusercontent.com/51840849/87153925-ef265e80-c2c0-11ea-91b5-020c804b90e0.jpg',
|
'logo': 'https://user-images.githubusercontent.com/51840849/87153925-ef265e80-c2c0-11ea-91b5-020c804b90e0.jpg',
|
||||||
'api': 'https://webapi.coinfloor.co.uk/bist',
|
'api': 'https://webapi.coinfloor.co.uk/v2/bist',
|
||||||
'www': 'https://www.coinfloor.co.uk',
|
'www': 'https://www.coinfloor.co.uk',
|
||||||
'doc': [
|
'doc': [
|
||||||
'https://github.com/coinfloor/api',
|
'https://github.com/coinfloor/api',
|
||||||
@@ -90,7 +90,7 @@ module.exports = class coinfloor extends Exchange {
|
|||||||
market = this.markets_by_id[marketId];
|
market = this.markets_by_id[marketId];
|
||||||
}
|
}
|
||||||
if (market === undefined) {
|
if (market === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchBalance requires a symbol param');
|
throw new ArgumentsRequired (this.id + ' fetchBalance() requires a symbol param');
|
||||||
}
|
}
|
||||||
const request = {
|
const request = {
|
||||||
'id': market['id'],
|
'id': market['id'],
|
||||||
@@ -223,7 +223,7 @@ module.exports = class coinfloor extends Exchange {
|
|||||||
if (code !== undefined) {
|
if (code !== undefined) {
|
||||||
market = this.market (code);
|
market = this.market (code);
|
||||||
if (market === undefined) {
|
if (market === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchTransactions requires a code argument (a market symbol)');
|
throw new ArgumentsRequired (this.id + ' fetchTransactions() requires a code argument (a market symbol)');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const request = {
|
const request = {
|
||||||
@@ -431,7 +431,7 @@ module.exports = class coinfloor extends Exchange {
|
|||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -480,6 +480,7 @@ module.exports = class coinfloor extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -495,7 +496,7 @@ module.exports = class coinfloor extends Exchange {
|
|||||||
|
|
||||||
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOpenOrders requires a symbol param');
|
throw new ArgumentsRequired (this.id + ' fetchOpenOrders() requires a symbol param');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
|
|||||||
Generated
Vendored
+2
@@ -150,6 +150,8 @@ module.exports = class coinmarketcap extends Exchange {
|
|||||||
// https://github.com/ccxt/ccxt/issues/6081
|
// https://github.com/ccxt/ccxt/issues/6081
|
||||||
// https://github.com/ccxt/ccxt/issues/3365
|
// https://github.com/ccxt/ccxt/issues/3365
|
||||||
// https://github.com/ccxt/ccxt/issues/2873
|
// https://github.com/ccxt/ccxt/issues/2873
|
||||||
|
'SBTCT': 'SiamBitcoin', // conflict with sBTC
|
||||||
|
'Super Bitcoin': 'Super Bitcoin', // conflict with sBTC
|
||||||
'TerraCredit': 'TerraCredit', // conflict with CREDIT (PROXI)
|
'TerraCredit': 'TerraCredit', // conflict with CREDIT (PROXI)
|
||||||
'Themis': 'Themis', // conflict with GET (Guaranteed Entrance Token, GET Protocol)
|
'Themis': 'Themis', // conflict with GET (Guaranteed Entrance Token, GET Protocol)
|
||||||
'UNI COIN': 'UNI COIN', // conflict with UNI (Uniswap)
|
'UNI COIN': 'UNI COIN', // conflict with UNI (Uniswap)
|
||||||
|
|||||||
Generated
Vendored
+2
-1
@@ -529,7 +529,7 @@ module.exports = class coinmate extends Exchange {
|
|||||||
|
|
||||||
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -641,6 +641,7 @@ module.exports = class coinmate extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': stopPrice,
|
'stopPrice': stopPrice,
|
||||||
|
|||||||
Generated
Vendored
+5
-4
@@ -373,7 +373,7 @@ module.exports = class coinone extends Exchange {
|
|||||||
|
|
||||||
async fetchOrder (id, symbol = undefined, params = {}) {
|
async fetchOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -518,6 +518,7 @@ module.exports = class coinone extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -567,7 +568,7 @@ module.exports = class coinone extends Exchange {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -602,14 +603,14 @@ module.exports = class coinone extends Exchange {
|
|||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
// eslint-disable-next-line quotes
|
// eslint-disable-next-line quotes
|
||||||
throw new ArgumentsRequired (this.id + " cancelOrder requires a symbol argument. To cancel the order, pass a symbol argument and {'price': 12345, 'qty': 1.2345, 'is_ask': 0} in the params argument of cancelOrder.");
|
throw new ArgumentsRequired (this.id + " cancelOrder() requires a symbol argument. To cancel the order, pass a symbol argument and {'price': 12345, 'qty': 1.2345, 'is_ask': 0} in the params argument of cancelOrder.");
|
||||||
}
|
}
|
||||||
const price = this.safeFloat (params, 'price');
|
const price = this.safeFloat (params, 'price');
|
||||||
const qty = this.safeFloat (params, 'qty');
|
const qty = this.safeFloat (params, 'qty');
|
||||||
const isAsk = this.safeInteger (params, 'is_ask');
|
const isAsk = this.safeInteger (params, 'is_ask');
|
||||||
if ((price === undefined) || (qty === undefined) || (isAsk === undefined)) {
|
if ((price === undefined) || (qty === undefined) || (isAsk === undefined)) {
|
||||||
// eslint-disable-next-line quotes
|
// eslint-disable-next-line quotes
|
||||||
throw new ArgumentsRequired (this.id + " cancelOrder requires {'price': 12345, 'qty': 1.2345, 'is_ask': 0} in the params argument.");
|
throw new ArgumentsRequired (this.id + " cancelOrder() requires {'price': 12345, 'qty': 1.2345, 'is_ask': 0} in the params argument.");
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {
|
const request = {
|
||||||
|
|||||||
Generated
Vendored
+65
-13
@@ -3,7 +3,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const Exchange = require ('./base/Exchange');
|
const Exchange = require ('./base/Exchange');
|
||||||
const { ExchangeError, AuthenticationError, NotSupported } = require ('./base/errors');
|
const { ExchangeError, ArgumentsRequired, AuthenticationError } = require ('./base/errors');
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -70,27 +70,72 @@ module.exports = class coinspot extends Exchange {
|
|||||||
},
|
},
|
||||||
'markets': {
|
'markets': {
|
||||||
'BTC/AUD': { 'id': 'btc', 'symbol': 'BTC/AUD', 'base': 'BTC', 'quote': 'AUD', 'baseId': 'btc', 'quoteId': 'aud' },
|
'BTC/AUD': { 'id': 'btc', 'symbol': 'BTC/AUD', 'base': 'BTC', 'quote': 'AUD', 'baseId': 'btc', 'quoteId': 'aud' },
|
||||||
|
'ETH/AUD': { 'id': 'eth', 'symbol': 'ETH/AUD', 'base': 'ETH', 'quote': 'AUD', 'baseId': 'eth', 'quoteId': 'aud' },
|
||||||
|
'XRP/AUD': { 'id': 'xrp', 'symbol': 'XRP/AUD', 'base': 'XRP', 'quote': 'AUD', 'baseId': 'xrp', 'quoteId': 'aud' },
|
||||||
'LTC/AUD': { 'id': 'ltc', 'symbol': 'LTC/AUD', 'base': 'LTC', 'quote': 'AUD', 'baseId': 'ltc', 'quoteId': 'aud' },
|
'LTC/AUD': { 'id': 'ltc', 'symbol': 'LTC/AUD', 'base': 'LTC', 'quote': 'AUD', 'baseId': 'ltc', 'quoteId': 'aud' },
|
||||||
'DOGE/AUD': { 'id': 'doge', 'symbol': 'DOGE/AUD', 'base': 'DOGE', 'quote': 'AUD', 'baseId': 'doge', 'quoteId': 'aud' },
|
'DOGE/AUD': { 'id': 'doge', 'symbol': 'DOGE/AUD', 'base': 'DOGE', 'quote': 'AUD', 'baseId': 'doge', 'quoteId': 'aud' },
|
||||||
|
'RFOX/AUD': { 'id': 'rfox', 'symbol': 'RFOX/AUD', 'base': 'RFOX', 'quote': 'AUD', 'baseId': 'rfox', 'quoteId': 'aud' },
|
||||||
|
'POWR/AUD': { 'id': 'powr', 'symbol': 'POWR/AUD', 'base': 'POWR', 'quote': 'AUD', 'baseId': 'powr', 'quoteId': 'aud' },
|
||||||
|
'NEO/AUD': { 'id': 'neo', 'symbol': 'NEO/AUD', 'base': 'NEO', 'quote': 'AUD', 'baseId': 'neo', 'quoteId': 'aud' },
|
||||||
|
'TRX/AUD': { 'id': 'trx', 'symbol': 'TRX/AUD', 'base': 'TRX', 'quote': 'AUD', 'baseId': 'trx', 'quoteId': 'aud' },
|
||||||
|
'EOS/AUD': { 'id': 'eos', 'symbol': 'EOS/AUD', 'base': 'EOS', 'quote': 'AUD', 'baseId': 'eos', 'quoteId': 'aud' },
|
||||||
|
'XLM/AUD': { 'id': 'xlm', 'symbol': 'XLM/AUD', 'base': 'XLM', 'quote': 'AUD', 'baseId': 'xlm', 'quoteId': 'aud' },
|
||||||
|
'RHOC/AUD': { 'id': 'rhoc', 'symbol': 'RHOC/AUD', 'base': 'RHOC', 'quote': 'AUD', 'baseId': 'rhoc', 'quoteId': 'aud' },
|
||||||
|
'GAS/AUD': { 'id': 'gas', 'symbol': 'GAS/AUD', 'base': 'GAS', 'quote': 'AUD', 'baseId': 'gas', 'quoteId': 'aud' },
|
||||||
},
|
},
|
||||||
'commonCurrencies': {
|
'commonCurrencies': {
|
||||||
'DRK': 'DASH',
|
'DRK': 'DASH',
|
||||||
},
|
},
|
||||||
|
'options': {
|
||||||
|
'fetchBalance': 'private_post_my_balances',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchBalance (params = {}) {
|
async fetchBalance (params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const response = await this.privatePostMyBalances (params);
|
const method = this.safeString (this.options, 'fetchBalance', 'private_post_my_balances');
|
||||||
|
const response = await this[method] (params);
|
||||||
|
//
|
||||||
|
// read-write api keys
|
||||||
|
//
|
||||||
|
// ...
|
||||||
|
//
|
||||||
|
// read-only api keys
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "status":"ok",
|
||||||
|
// "balances":[
|
||||||
|
// {
|
||||||
|
// "LTC":{"balance":0.1,"audbalance":16.59,"rate":165.95}
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
// }
|
||||||
|
//
|
||||||
const result = { 'info': response };
|
const result = { 'info': response };
|
||||||
const balances = this.safeValue (response, 'balance', {});
|
const balances = this.safeValue2 (response, 'balance', 'balances');
|
||||||
const currencyIds = Object.keys (balances);
|
if (Array.isArray (balances)) {
|
||||||
for (let i = 0; i < currencyIds.length; i++) {
|
for (let i = 0; i < balances.length; i++) {
|
||||||
const currencyId = currencyIds[i];
|
const currencies = balances[i];
|
||||||
const code = this.safeCurrencyCode (currencyId);
|
const currencyIds = Object.keys (currencies);
|
||||||
const account = this.account ();
|
for (let j = 0; j < currencyIds.length; j++) {
|
||||||
account['total'] = this.safeFloat (balances, currencyId);
|
const currencyId = currencyIds[j];
|
||||||
result[code] = account;
|
const balance = currencies[currencyId];
|
||||||
|
const code = this.safeCurrencyCode (currencyId);
|
||||||
|
const account = this.account ();
|
||||||
|
account['total'] = this.safeFloat (balance, 'balance');
|
||||||
|
result[code] = account;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const currencyIds = Object.keys (balances);
|
||||||
|
for (let i = 0; i < currencyIds.length; i++) {
|
||||||
|
const currencyId = currencyIds[i];
|
||||||
|
const code = this.safeCurrencyCode (currencyId);
|
||||||
|
const account = this.account ();
|
||||||
|
account['total'] = this.safeFloat (balances, currencyId);
|
||||||
|
result[code] = account;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return this.parseBalance (result);
|
return this.parseBalance (result);
|
||||||
}
|
}
|
||||||
@@ -210,9 +255,16 @@ module.exports = class coinspot extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
throw new NotSupported (this.id + ' cancelOrder () is not fully implemented yet');
|
const side = this.safeString (params, 'side');
|
||||||
// let method = 'privatePostMyBuy';
|
if (side !== 'buy' && side !== 'sell') {
|
||||||
// return await this[method] ({ 'id': id });
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a side parameter, "buy" or "sell"');
|
||||||
|
}
|
||||||
|
params = this.omit (params, 'side');
|
||||||
|
const method = 'privatePostMy' + this.capitalize (side) + 'Cancel';
|
||||||
|
const request = {
|
||||||
|
'id': id,
|
||||||
|
};
|
||||||
|
return await this[method] (this.extend (request, params));
|
||||||
}
|
}
|
||||||
|
|
||||||
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
||||||
|
|||||||
Generated
Vendored
+4
-2
@@ -133,6 +133,7 @@ module.exports = class crex24 extends Exchange {
|
|||||||
'GHOST': 'GHOSTPRISM',
|
'GHOST': 'GHOSTPRISM',
|
||||||
'IQ': 'IQ.Cash',
|
'IQ': 'IQ.Cash',
|
||||||
'PUT': 'PutinCoin',
|
'PUT': 'PutinCoin',
|
||||||
|
'SBTC': 'SBTCT', // SiamBitcoin
|
||||||
'UNI': 'Universe',
|
'UNI': 'Universe',
|
||||||
'YOYO': 'YOYOW',
|
'YOYO': 'YOYOW',
|
||||||
},
|
},
|
||||||
@@ -158,6 +159,7 @@ module.exports = class crex24 extends Exchange {
|
|||||||
"Parameter 'instrument' contains invalid value.": BadSymbol,
|
"Parameter 'instrument' contains invalid value.": BadSymbol,
|
||||||
},
|
},
|
||||||
'broad': {
|
'broad': {
|
||||||
|
'try again later': ExchangeNotAvailable, // {"errorDescription":"Failed to process the request. Please, try again later."}
|
||||||
'API Key': AuthenticationError, // "API Key '9edc48de-d5b0-4248-8e7e-f59ffcd1c7f1' doesn't exist."
|
'API Key': AuthenticationError, // "API Key '9edc48de-d5b0-4248-8e7e-f59ffcd1c7f1' doesn't exist."
|
||||||
'Insufficient funds': InsufficientFunds, // "Insufficient funds: new order requires 10 ETH which is more than the available balance."
|
'Insufficient funds': InsufficientFunds, // "Insufficient funds: new order requires 10 ETH which is more than the available balance."
|
||||||
'has been delisted.': BadSymbol, // {"errorDescription":"Instrument '$PAC-BTC' has been delisted."}
|
'has been delisted.': BadSymbol, // {"errorDescription":"Instrument '$PAC-BTC' has been delisted."}
|
||||||
@@ -757,14 +759,14 @@ module.exports = class crex24 extends Exchange {
|
|||||||
}
|
}
|
||||||
if (priceIsRequired) {
|
if (priceIsRequired) {
|
||||||
if (price === undefined) {
|
if (price === undefined) {
|
||||||
throw new InvalidOrder (this.id + ' createOrder method requires a price argument for a ' + type + ' order');
|
throw new InvalidOrder (this.id + ' createOrder() requires a price argument for a ' + type + ' order');
|
||||||
}
|
}
|
||||||
request['price'] = this.priceToPrecision (symbol, price);
|
request['price'] = this.priceToPrecision (symbol, price);
|
||||||
}
|
}
|
||||||
if (stopPriceIsRequired) {
|
if (stopPriceIsRequired) {
|
||||||
const stopPrice = this.safeFloat (params, 'stopPrice');
|
const stopPrice = this.safeFloat (params, 'stopPrice');
|
||||||
if (stopPrice === undefined) {
|
if (stopPrice === undefined) {
|
||||||
throw new InvalidOrder (this.id + ' createOrder method requires a stopPrice extra param for a ' + type + ' order');
|
throw new InvalidOrder (this.id + ' createOrder() requires a stopPrice extra param for a ' + type + ' order');
|
||||||
} else {
|
} else {
|
||||||
request['stopPrice'] = this.priceToPrecision (symbol, stopPrice);
|
request['stopPrice'] = this.priceToPrecision (symbol, stopPrice);
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
Vendored
+4
-4
@@ -916,7 +916,7 @@ module.exports = class currencycom extends Exchange {
|
|||||||
if (market['margin']) {
|
if (market['margin']) {
|
||||||
accountId = this.safeInteger (params, 'accountId');
|
accountId = this.safeInteger (params, 'accountId');
|
||||||
if (accountId === undefined) {
|
if (accountId === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' createOrder requires an accountId parameter for ' + market['type'] + ' market ' + symbol);
|
throw new ArgumentsRequired (this.id + ' createOrder() requires an accountId parameter for ' + market['type'] + ' market ' + symbol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const uppercaseType = type.toUpperCase ();
|
const uppercaseType = type.toUpperCase ();
|
||||||
@@ -977,7 +977,7 @@ module.exports = class currencycom extends Exchange {
|
|||||||
const symbols = this.symbols;
|
const symbols = this.symbols;
|
||||||
const numSymbols = symbols.length;
|
const numSymbols = symbols.length;
|
||||||
const fetchOpenOrdersRateLimit = parseInt (numSymbols / 2);
|
const fetchOpenOrdersRateLimit = parseInt (numSymbols / 2);
|
||||||
throw new ExchangeError (this.id + ' fetchOpenOrders WARNING: fetching open orders without specifying a symbol is rate-limited to one call per ' + fetchOpenOrdersRateLimit.toString () + ' seconds. Do not call this method frequently to avoid ban. Set ' + this.id + '.options["warnOnFetchOpenOrdersWithoutSymbol"] = false to suppress this warning message.');
|
throw new ExchangeError (this.id + ' fetchOpenOrders() WARNING: fetching open orders without specifying a symbol is rate-limited to one call per ' + fetchOpenOrdersRateLimit.toString () + ' seconds. Do not call this method frequently to avoid ban. Set ' + this.id + '.options["warnOnFetchOpenOrdersWithoutSymbol"] = false to suppress this warning message.');
|
||||||
}
|
}
|
||||||
const response = await this.privateGetOpenOrders (this.extend (request, params));
|
const response = await this.privateGetOpenOrders (this.extend (request, params));
|
||||||
return this.parseOrders (response, market, since, limit);
|
return this.parseOrders (response, market, since, limit);
|
||||||
@@ -985,7 +985,7 @@ module.exports = class currencycom extends Exchange {
|
|||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -1020,7 +1020,7 @@ module.exports = class currencycom extends Exchange {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
|
|||||||
Generated
Vendored
+1483
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+11
-9
@@ -778,7 +778,7 @@ module.exports = class deribit extends Exchange {
|
|||||||
const now = this.milliseconds ();
|
const now = this.milliseconds ();
|
||||||
if (since === undefined) {
|
if (since === undefined) {
|
||||||
if (limit === undefined) {
|
if (limit === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOHLCV requires a since argument or a limit argument');
|
throw new ArgumentsRequired (this.id + ' fetchOHLCV() requires a since argument or a limit argument');
|
||||||
} else {
|
} else {
|
||||||
request['start_timestamp'] = now - (limit - 1) * duration * 1000;
|
request['start_timestamp'] = now - (limit - 1) * duration * 1000;
|
||||||
request['end_timestamp'] = now;
|
request['end_timestamp'] = now;
|
||||||
@@ -1011,7 +1011,7 @@ module.exports = class deribit extends Exchange {
|
|||||||
'cancelled': 'canceled',
|
'cancelled': 'canceled',
|
||||||
'filled': 'closed',
|
'filled': 'closed',
|
||||||
'rejected': 'rejected',
|
'rejected': 'rejected',
|
||||||
// 'untriggered': 'open',
|
'untriggered': 'open',
|
||||||
};
|
};
|
||||||
return this.safeString (statuses, status, status);
|
return this.safeString (statuses, status, status);
|
||||||
}
|
}
|
||||||
@@ -1096,7 +1096,8 @@ module.exports = class deribit extends Exchange {
|
|||||||
trades = this.parseTrades (trades, market);
|
trades = this.parseTrades (trades, market);
|
||||||
}
|
}
|
||||||
const timeInForce = this.parseTimeInForce (this.safeString (order, 'time_in_force'));
|
const timeInForce = this.parseTimeInForce (this.safeString (order, 'time_in_force'));
|
||||||
const stopPrice = undefined;
|
const stopPrice = this.safeValue (order, 'stop_price');
|
||||||
|
const postOnly = this.safeValue (order, 'post_only');
|
||||||
return {
|
return {
|
||||||
'info': order,
|
'info': order,
|
||||||
'id': id,
|
'id': id,
|
||||||
@@ -1107,6 +1108,7 @@ module.exports = class deribit extends Exchange {
|
|||||||
'symbol': market['symbol'],
|
'symbol': market['symbol'],
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': timeInForce,
|
'timeInForce': timeInForce,
|
||||||
|
'postOnly': postOnly,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': stopPrice,
|
'stopPrice': stopPrice,
|
||||||
@@ -1191,13 +1193,13 @@ module.exports = class deribit extends Exchange {
|
|||||||
if (price !== undefined) {
|
if (price !== undefined) {
|
||||||
request['price'] = this.priceToPrecision (symbol, price);
|
request['price'] = this.priceToPrecision (symbol, price);
|
||||||
} else {
|
} else {
|
||||||
throw new ArgumentsRequired (this.id + ' createOrder requires a price argument for a ' + type + ' order');
|
throw new ArgumentsRequired (this.id + ' createOrder() requires a price argument for a ' + type + ' order');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stopPriceIsRequired) {
|
if (stopPriceIsRequired) {
|
||||||
const stopPrice = this.safeFloat2 (params, 'stop_price', 'stopPrice');
|
const stopPrice = this.safeFloat2 (params, 'stop_price', 'stopPrice');
|
||||||
if (stopPrice === undefined) {
|
if (stopPrice === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' createOrder requires a stop_price or stopPrice param for a ' + type + ' order');
|
throw new ArgumentsRequired (this.id + ' createOrder() requires a stop_price or stopPrice param for a ' + type + ' order');
|
||||||
} else {
|
} else {
|
||||||
request['stop_price'] = this.priceToPrecision (symbol, stopPrice);
|
request['stop_price'] = this.priceToPrecision (symbol, stopPrice);
|
||||||
}
|
}
|
||||||
@@ -1266,10 +1268,10 @@ module.exports = class deribit extends Exchange {
|
|||||||
|
|
||||||
async editOrder (id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
async editOrder (id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
||||||
if (amount === undefined) {
|
if (amount === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' editOrder requires an amount argument');
|
throw new ArgumentsRequired (this.id + ' editOrder() requires an amount argument');
|
||||||
}
|
}
|
||||||
if (price === undefined) {
|
if (price === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' editOrder requires a price argument');
|
throw new ArgumentsRequired (this.id + ' editOrder() requires a price argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {
|
const request = {
|
||||||
@@ -1631,7 +1633,7 @@ module.exports = class deribit extends Exchange {
|
|||||||
const request = {
|
const request = {
|
||||||
'instrument_name': market['id'],
|
'instrument_name': market['id'],
|
||||||
};
|
};
|
||||||
const response = await this.privateGetPosition (this.extend (request, params));
|
const response = await this.privateGetGetPosition (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// "jsonrpc": "2.0",
|
// "jsonrpc": "2.0",
|
||||||
@@ -1670,7 +1672,7 @@ module.exports = class deribit extends Exchange {
|
|||||||
const request = {
|
const request = {
|
||||||
'currency': currency['id'],
|
'currency': currency['id'],
|
||||||
};
|
};
|
||||||
const response = await this.privateGetPositions (this.extend (request, params));
|
const response = await this.privateGetGetPositions (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// "jsonrpc": "2.0",
|
// "jsonrpc": "2.0",
|
||||||
|
|||||||
Generated
Vendored
+4
-3
@@ -502,7 +502,7 @@ module.exports = class digifinex extends Exchange {
|
|||||||
async fetchTickers (symbols = undefined, params = {}) {
|
async fetchTickers (symbols = undefined, params = {}) {
|
||||||
const apiKey = this.safeValue (params, 'apiKey', this.apiKey);
|
const apiKey = this.safeValue (params, 'apiKey', this.apiKey);
|
||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchTicker is a private v2 endpoint that requires an `exchange.apiKey` credential or an `apiKey` extra parameter');
|
throw new ArgumentsRequired (this.id + ' fetchTickers() is a private v2 endpoint that requires an `exchange.apiKey` credential or an `apiKey` extra parameter');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {
|
const request = {
|
||||||
@@ -548,7 +548,7 @@ module.exports = class digifinex extends Exchange {
|
|||||||
async fetchTicker (symbol, params = {}) {
|
async fetchTicker (symbol, params = {}) {
|
||||||
const apiKey = this.safeValue (params, 'apiKey', this.apiKey);
|
const apiKey = this.safeValue (params, 'apiKey', this.apiKey);
|
||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchTicker is a private v2 endpoint that requires an `exchange.apiKey` credential or an `apiKey` extra parameter');
|
throw new ArgumentsRequired (this.id + ' fetchTicker() is a private v2 endpoint that requires an `exchange.apiKey` credential or an `apiKey` extra parameter');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -994,6 +994,7 @@ module.exports = class digifinex extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -1284,7 +1285,7 @@ module.exports = class digifinex extends Exchange {
|
|||||||
const address = this.safeString (depositAddress, 'address');
|
const address = this.safeString (depositAddress, 'address');
|
||||||
const tag = this.safeString (depositAddress, 'addressTag');
|
const tag = this.safeString (depositAddress, 'addressTag');
|
||||||
const currencyId = this.safeStringUpper (depositAddress, 'currency');
|
const currencyId = this.safeStringUpper (depositAddress, 'currency');
|
||||||
const code = this.safeCurrencCode (currencyId);
|
const code = this.safeCurrencyCode (currencyId);
|
||||||
return {
|
return {
|
||||||
'info': depositAddress,
|
'info': depositAddress,
|
||||||
'code': code,
|
'code': code,
|
||||||
|
|||||||
Generated
Vendored
+2
-1
@@ -653,7 +653,7 @@ module.exports = class dsx extends Exchange {
|
|||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
if (type === 'market' && price === undefined) {
|
if (type === 'market' && price === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' createOrder requires a price argument even for market orders, that is the worst price that you agree to fill your order for');
|
throw new ArgumentsRequired (this.id + ' createOrder() requires a price argument even for market orders, that is the worst price that you agree to fill your order for');
|
||||||
}
|
}
|
||||||
const request = {
|
const request = {
|
||||||
'pair': market['id'],
|
'pair': market['id'],
|
||||||
@@ -840,6 +840,7 @@ module.exports = class dsx extends Exchange {
|
|||||||
'lastTradeTimestamp': lastTradeTimestamp,
|
'lastTradeTimestamp': lastTradeTimestamp,
|
||||||
'type': orderType,
|
'type': orderType,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+1548
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+4
-2
@@ -605,7 +605,7 @@ module.exports = class eterbase extends Exchange {
|
|||||||
request['start'] = now - duration * limit * 1000;
|
request['start'] = now - duration * limit * 1000;
|
||||||
request['end'] = now;
|
request['end'] = now;
|
||||||
} else {
|
} else {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOHLCV requires a since argument, or a limit argument, or both');
|
throw new ArgumentsRequired (this.id + ' fetchOHLCV() requires a since argument, or a limit argument, or both');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -807,6 +807,7 @@ module.exports = class eterbase extends Exchange {
|
|||||||
}
|
}
|
||||||
const timeInForce = this.safeString (order, 'timeInForce');
|
const timeInForce = this.safeString (order, 'timeInForce');
|
||||||
const stopPrice = this.safeFloat (order, 'stopPrice');
|
const stopPrice = this.safeFloat (order, 'stopPrice');
|
||||||
|
const postOnly = this.safeValue (order, 'postOnly');
|
||||||
return {
|
return {
|
||||||
'info': order,
|
'info': order,
|
||||||
'id': id,
|
'id': id,
|
||||||
@@ -816,8 +817,9 @@ module.exports = class eterbase extends Exchange {
|
|||||||
'lastTradeTimestamp': undefined,
|
'lastTradeTimestamp': undefined,
|
||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'side': side,
|
|
||||||
'timeInForce': timeInForce,
|
'timeInForce': timeInForce,
|
||||||
|
'postOnly': postOnly,
|
||||||
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': stopPrice,
|
'stopPrice': stopPrice,
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
|
|||||||
Generated
Vendored
+25
-10
@@ -702,7 +702,7 @@ module.exports = class exmo extends Exchange {
|
|||||||
const now = this.milliseconds ();
|
const now = this.milliseconds ();
|
||||||
if (since === undefined) {
|
if (since === undefined) {
|
||||||
if (limit === undefined) {
|
if (limit === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOHLCV requires a since argument or a limit argument');
|
throw new ArgumentsRequired (this.id + ' fetchOHLCV() requires a since argument or a limit argument');
|
||||||
} else {
|
} else {
|
||||||
if (limit > maxLimit) {
|
if (limit > maxLimit) {
|
||||||
throw new BadRequest (this.id + ' fetchOHLCV will serve ' + maxLimit.toString () + ' candles at most');
|
throw new BadRequest (this.id + ' fetchOHLCV will serve ' + maxLimit.toString () + ' candles at most');
|
||||||
@@ -1318,6 +1318,7 @@ module.exports = class exmo extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -1436,12 +1437,21 @@ module.exports = class exmo extends Exchange {
|
|||||||
const type = this.safeString (transaction, 'type');
|
const type = this.safeString (transaction, 'type');
|
||||||
const currencyId = this.safeString (transaction, 'curr');
|
const currencyId = this.safeString (transaction, 'curr');
|
||||||
const code = this.safeCurrencyCode (currencyId, currency);
|
const code = this.safeCurrencyCode (currencyId, currency);
|
||||||
let address = this.safeString (transaction, 'account');
|
let address = undefined;
|
||||||
if (address !== undefined) {
|
const tag = undefined;
|
||||||
const parts = address.split (':');
|
let comment = undefined;
|
||||||
const numParts = parts.length;
|
const account = this.safeString (transaction, 'account');
|
||||||
if (numParts === 2) {
|
if (type === 'deposit') {
|
||||||
address = parts[1].replace (' ', '');
|
comment = account;
|
||||||
|
} else if (type === 'withdrawal') {
|
||||||
|
address = account;
|
||||||
|
if (address !== undefined) {
|
||||||
|
const parts = address.split (':');
|
||||||
|
const numParts = parts.length;
|
||||||
|
if (numParts === 2) {
|
||||||
|
address = this.safeString (parts, 1);
|
||||||
|
address = address.replace (' ', '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let fee = undefined;
|
let fee = undefined;
|
||||||
@@ -1469,16 +1479,21 @@ module.exports = class exmo extends Exchange {
|
|||||||
return {
|
return {
|
||||||
'info': transaction,
|
'info': transaction,
|
||||||
'id': undefined,
|
'id': undefined,
|
||||||
|
'timestamp': timestamp,
|
||||||
|
'datetime': this.iso8601 (timestamp),
|
||||||
'currency': code,
|
'currency': code,
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
'address': address,
|
'address': address,
|
||||||
'tag': undefined, // refix it properly
|
'addressTo': address,
|
||||||
|
'addressFrom': undefined,
|
||||||
|
'tag': tag,
|
||||||
|
'tagTo': tag,
|
||||||
|
'tagFrom': undefined,
|
||||||
'status': status,
|
'status': status,
|
||||||
'type': type,
|
'type': type,
|
||||||
'updated': undefined,
|
'updated': undefined,
|
||||||
|
'comment': comment,
|
||||||
'txid': txid,
|
'txid': txid,
|
||||||
'timestamp': timestamp,
|
|
||||||
'datetime': this.iso8601 (timestamp),
|
|
||||||
'fee': fee,
|
'fee': fee,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
Vendored
+2
-1
@@ -326,6 +326,7 @@ module.exports = class exx extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': order['type'],
|
'side': order['type'],
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -387,7 +388,7 @@ module.exports = class exx extends Exchange {
|
|||||||
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOpenOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOpenOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
const request = {
|
const request = {
|
||||||
|
|||||||
Generated
Vendored
+1
@@ -592,6 +592,7 @@ module.exports = class fcoin extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': orderType,
|
'type': orderType,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+1
-1
@@ -246,7 +246,7 @@ module.exports = class flowbtc extends Exchange {
|
|||||||
};
|
};
|
||||||
return await this.privatePostCancelOrder (this.extend (request, params));
|
return await this.privatePostCancelOrder (this.extend (request, params));
|
||||||
}
|
}
|
||||||
throw new ExchangeError (this.id + ' requires `ins` symbol parameter for cancelling an order');
|
throw new ExchangeError (this.id + ' cancelOrder() requires an `ins` symbol parameter for cancelling an order');
|
||||||
}
|
}
|
||||||
|
|
||||||
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
||||||
|
|||||||
Generated
Vendored
+94
-30
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
const Exchange = require ('./base/Exchange');
|
const Exchange = require ('./base/Exchange');
|
||||||
const { TICK_SIZE } = require ('./base/functions/number');
|
const { TICK_SIZE } = require ('./base/functions/number');
|
||||||
const { ExchangeError, InvalidOrder, BadRequest, InsufficientFunds, OrderNotFound, AuthenticationError } = require ('./base/errors');
|
const { ExchangeError, InvalidOrder, BadRequest, InsufficientFunds, OrderNotFound, AuthenticationError, RateLimitExceeded, ExchangeNotAvailable, CancelPending } = require ('./base/errors');
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ module.exports = class ftx extends Exchange {
|
|||||||
'id': 'ftx',
|
'id': 'ftx',
|
||||||
'name': 'FTX',
|
'name': 'FTX',
|
||||||
'countries': [ 'HK' ],
|
'countries': [ 'HK' ],
|
||||||
'rateLimit': 100,
|
'rateLimit': 50,
|
||||||
'certified': true,
|
'certified': true,
|
||||||
'pro': true,
|
'pro': true,
|
||||||
'hostname': 'ftx.com', // or ftx.us
|
'hostname': 'ftx.com', // or ftx.us
|
||||||
@@ -99,9 +99,12 @@ module.exports = class ftx extends Exchange {
|
|||||||
'wallet/coins',
|
'wallet/coins',
|
||||||
'wallet/balances',
|
'wallet/balances',
|
||||||
'wallet/all_balances',
|
'wallet/all_balances',
|
||||||
'wallet/deposit_address/{coin}',
|
'wallet/deposit_address/{coin}', // ?method={method}
|
||||||
'wallet/deposits',
|
'wallet/deposits',
|
||||||
'wallet/withdrawals',
|
'wallet/withdrawals',
|
||||||
|
'wallet/withdrawal_fee',
|
||||||
|
'wallet/airdrops',
|
||||||
|
'wallet/saved_addresses',
|
||||||
'orders', // ?market={market}
|
'orders', // ?market={market}
|
||||||
'orders/history', // ?market={market}
|
'orders/history', // ?market={market}
|
||||||
'orders/{order_id}',
|
'orders/{order_id}',
|
||||||
@@ -109,6 +112,14 @@ module.exports = class ftx extends Exchange {
|
|||||||
'conditional_orders', // ?market={market}
|
'conditional_orders', // ?market={market}
|
||||||
'conditional_orders/{conditional_order_id}/triggers',
|
'conditional_orders/{conditional_order_id}/triggers',
|
||||||
'conditional_orders/history', // ?market={market}
|
'conditional_orders/history', // ?market={market}
|
||||||
|
'spot_margin/borrow_rates',
|
||||||
|
'spot_margin/lending_rates',
|
||||||
|
'spot_margin/borrow_summary',
|
||||||
|
'spot_margin/market_info', // ?market={market}
|
||||||
|
'spot_margin/borrow_history',
|
||||||
|
'spot_margin/lending_history',
|
||||||
|
'spot_margin/offers',
|
||||||
|
'spot_margin/lending_info',
|
||||||
'fills', // ?market={market}
|
'fills', // ?market={market}
|
||||||
'funding_payments',
|
'funding_payments',
|
||||||
// leverage tokens
|
// leverage tokens
|
||||||
@@ -127,15 +138,23 @@ module.exports = class ftx extends Exchange {
|
|||||||
'options/account_info',
|
'options/account_info',
|
||||||
'options/positions',
|
'options/positions',
|
||||||
'options/fills',
|
'options/fills',
|
||||||
|
// staking
|
||||||
|
'staking/stakes',
|
||||||
|
'staking/unstake_requests',
|
||||||
|
'staking/balances',
|
||||||
|
'staking/staking_rewards',
|
||||||
],
|
],
|
||||||
'post': [
|
'post': [
|
||||||
'account/leverage',
|
'account/leverage',
|
||||||
'wallet/withdrawals',
|
'wallet/withdrawals',
|
||||||
|
'wallet/saved_addresses',
|
||||||
'orders',
|
'orders',
|
||||||
'conditional_orders',
|
'conditional_orders',
|
||||||
'orders/{order_id}/modify',
|
'orders/{order_id}/modify',
|
||||||
'orders/by_client_id/{client_order_id}/modify',
|
'orders/by_client_id/{client_order_id}/modify',
|
||||||
'conditional_orders/{order_id}/modify',
|
'conditional_orders/{order_id}/modify',
|
||||||
|
// spot margin
|
||||||
|
'spot_margin/offers',
|
||||||
// leverage tokens
|
// leverage tokens
|
||||||
'lt/{token_name}/create',
|
'lt/{token_name}/create',
|
||||||
'lt/{token_name}/redeem',
|
'lt/{token_name}/redeem',
|
||||||
@@ -150,8 +169,12 @@ module.exports = class ftx extends Exchange {
|
|||||||
'options/requests',
|
'options/requests',
|
||||||
'options/requests/{request_id}/quotes',
|
'options/requests/{request_id}/quotes',
|
||||||
'options/quotes/{quote_id}/accept',
|
'options/quotes/{quote_id}/accept',
|
||||||
|
// staking
|
||||||
|
'staking/unstake_requests',
|
||||||
|
'srm_stakes/stakes',
|
||||||
],
|
],
|
||||||
'delete': [
|
'delete': [
|
||||||
|
'wallet/saved_addresses/{saved_address_id}',
|
||||||
'orders/{order_id}',
|
'orders/{order_id}',
|
||||||
'orders/by_client_id/{client_order_id}',
|
'orders/by_client_id/{client_order_id}',
|
||||||
'orders',
|
'orders',
|
||||||
@@ -161,6 +184,8 @@ module.exports = class ftx extends Exchange {
|
|||||||
// options
|
// options
|
||||||
'options/requests/{request_id}',
|
'options/requests/{request_id}',
|
||||||
'options/quotes/{quote_id}',
|
'options/quotes/{quote_id}',
|
||||||
|
// staking
|
||||||
|
'staking/unstake_requests/{request_id}',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -195,6 +220,8 @@ module.exports = class ftx extends Exchange {
|
|||||||
},
|
},
|
||||||
'exceptions': {
|
'exceptions': {
|
||||||
'exact': {
|
'exact': {
|
||||||
|
'Please slow down': RateLimitExceeded, // {"error":"Please slow down","success":false}
|
||||||
|
'Size too small for provide': InvalidOrder, // {"error":"Size too small for provide","success":false}
|
||||||
'Not logged in': AuthenticationError, // {"error":"Not logged in","success":false}
|
'Not logged in': AuthenticationError, // {"error":"Not logged in","success":false}
|
||||||
'Not enough balances': InsufficientFunds, // {"error":"Not enough balances","success":false}
|
'Not enough balances': InsufficientFunds, // {"error":"Not enough balances","success":false}
|
||||||
'InvalidPrice': InvalidOrder, // {"error":"Invalid price","success":false}
|
'InvalidPrice': InvalidOrder, // {"error":"Invalid price","success":false}
|
||||||
@@ -202,13 +229,18 @@ module.exports = class ftx extends Exchange {
|
|||||||
'Missing parameter price': InvalidOrder, // {"error":"Missing parameter price","success":false}
|
'Missing parameter price': InvalidOrder, // {"error":"Missing parameter price","success":false}
|
||||||
'Order not found': OrderNotFound, // {"error":"Order not found","success":false}
|
'Order not found': OrderNotFound, // {"error":"Order not found","success":false}
|
||||||
'Order already closed': InvalidOrder, // {"error":"Order already closed","success":false}
|
'Order already closed': InvalidOrder, // {"error":"Order already closed","success":false}
|
||||||
|
'Order already queued for cancellation': CancelPending, // {"error":"Order already queued for cancellation","success":false}
|
||||||
},
|
},
|
||||||
'broad': {
|
'broad': {
|
||||||
|
'Account does not have enough margin for order': InsufficientFunds,
|
||||||
'Invalid parameter': BadRequest, // {"error":"Invalid parameter start_time","success":false}
|
'Invalid parameter': BadRequest, // {"error":"Invalid parameter start_time","success":false}
|
||||||
'The requested URL was not found on the server': BadRequest,
|
'The requested URL was not found on the server': BadRequest,
|
||||||
'No such coin': BadRequest,
|
'No such coin': BadRequest,
|
||||||
'No such market': BadRequest,
|
'No such market': BadRequest,
|
||||||
'An unexpected error occurred': ExchangeError, // {"error":"An unexpected error occurred, please try again later (58BC21C795).","success":false}
|
'Do not send more than': RateLimitExceeded,
|
||||||
|
'An unexpected error occurred': ExchangeNotAvailable, // {"error":"An unexpected error occurred, please try again later (58BC21C795).","success":false}
|
||||||
|
'Please retry request': ExchangeNotAvailable, // {"error":"Please retry request","success":false}
|
||||||
|
'Please try again': ExchangeNotAvailable, // {"error":"Please try again","success":false}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'precisionMode': TICK_SIZE,
|
'precisionMode': TICK_SIZE,
|
||||||
@@ -338,7 +370,7 @@ module.exports = class ftx extends Exchange {
|
|||||||
'amount': sizeIncrement,
|
'amount': sizeIncrement,
|
||||||
'price': priceIncrement,
|
'price': priceIncrement,
|
||||||
};
|
};
|
||||||
const entry = {
|
result.push ({
|
||||||
'id': id,
|
'id': id,
|
||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'base': base,
|
'base': base,
|
||||||
@@ -365,8 +397,7 @@ module.exports = class ftx extends Exchange {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
'info': market,
|
'info': market,
|
||||||
};
|
});
|
||||||
result.push (entry);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -665,22 +696,39 @@ module.exports = class ftx extends Exchange {
|
|||||||
// "type": "order"
|
// "type": "order"
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
// {
|
||||||
|
// "baseCurrency": "BTC",
|
||||||
|
// "fee": 0,
|
||||||
|
// "feeCurrency": "USD",
|
||||||
|
// "feeRate": 0,
|
||||||
|
// "future": null,
|
||||||
|
// "id": 664079556,
|
||||||
|
// "liquidity": "taker",
|
||||||
|
// "market": null,
|
||||||
|
// "orderId": null,
|
||||||
|
// "price": 34830.61359,
|
||||||
|
// "quoteCurrency": "USD",
|
||||||
|
// "side": "sell",
|
||||||
|
// "size": 0.0005996,
|
||||||
|
// "time": "2021-01-15T16:05:29.246135+00:00",
|
||||||
|
// "tradeId": null,
|
||||||
|
// "type": "otc"
|
||||||
|
// }
|
||||||
|
//
|
||||||
const id = this.safeString (trade, 'id');
|
const id = this.safeString (trade, 'id');
|
||||||
const takerOrMaker = this.safeString (trade, 'liquidity');
|
const takerOrMaker = this.safeString (trade, 'liquidity');
|
||||||
const marketId = this.safeString (trade, 'market');
|
const marketId = this.safeString (trade, 'market');
|
||||||
let symbol = undefined;
|
let symbol = undefined;
|
||||||
if (marketId !== undefined) {
|
if (marketId in this.markets_by_id) {
|
||||||
if (marketId in this.markets_by_id) {
|
market = this.markets_by_id[marketId];
|
||||||
market = this.markets_by_id[marketId];
|
symbol = market['symbol'];
|
||||||
symbol = market['symbol'];
|
} else {
|
||||||
|
const base = this.safeCurrencyCode (this.safeString (trade, 'baseCurrency'));
|
||||||
|
const quote = this.safeCurrencyCode (this.safeString (trade, 'quoteCurrency'));
|
||||||
|
if ((base !== undefined) && (quote !== undefined)) {
|
||||||
|
symbol = base + '/' + quote;
|
||||||
} else {
|
} else {
|
||||||
const base = this.safeCurrencyCode (this.safeString (trade, 'baseCurrency'));
|
symbol = marketId;
|
||||||
const quote = this.safeCurrencyCode (this.safeString (trade, 'quoteCurrency'));
|
|
||||||
if ((base !== undefined) && (quote !== undefined)) {
|
|
||||||
symbol = base + '/' + quote;
|
|
||||||
} else {
|
|
||||||
symbol = marketId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const timestamp = this.parse8601 (this.safeString (trade, 'time'));
|
const timestamp = this.parse8601 (this.safeString (trade, 'time'));
|
||||||
@@ -998,6 +1046,7 @@ module.exports = class ftx extends Exchange {
|
|||||||
const lastTradeTimestamp = this.parse8601 (this.safeString (order, 'triggeredAt'));
|
const lastTradeTimestamp = this.parse8601 (this.safeString (order, 'triggeredAt'));
|
||||||
const clientOrderId = this.safeString (order, 'clientId');
|
const clientOrderId = this.safeString (order, 'clientId');
|
||||||
const stopPrice = this.safeFloat (order, 'triggerPrice');
|
const stopPrice = this.safeFloat (order, 'triggerPrice');
|
||||||
|
const postOnly = this.safeValue (order, 'postOnly');
|
||||||
return {
|
return {
|
||||||
'info': order,
|
'info': order,
|
||||||
'id': id,
|
'id': id,
|
||||||
@@ -1008,6 +1057,7 @@ module.exports = class ftx extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': postOnly,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': stopPrice,
|
'stopPrice': stopPrice,
|
||||||
@@ -1145,12 +1195,12 @@ module.exports = class ftx extends Exchange {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (clientOrderId === undefined) {
|
if (clientOrderId === undefined) {
|
||||||
|
method = 'privatePostOrdersOrderIdModify';
|
||||||
|
request['order_id'] = id;
|
||||||
|
} else {
|
||||||
method = 'privatePostOrdersByClientIdClientOrderIdModify';
|
method = 'privatePostOrdersByClientIdClientOrderIdModify';
|
||||||
request['client_order_id'] = clientOrderId;
|
request['client_order_id'] = clientOrderId;
|
||||||
// request['clientId'] = clientOrderId;
|
// request['clientId'] = clientOrderId;
|
||||||
} else {
|
|
||||||
method = 'privatePostOrdersOrderIdModify';
|
|
||||||
request['order_id'] = id;
|
|
||||||
}
|
}
|
||||||
if (price !== undefined) {
|
if (price !== undefined) {
|
||||||
request['price'] = parseFloat (this.priceToPrecision (symbol, price));
|
request['price'] = parseFloat (this.priceToPrecision (symbol, price));
|
||||||
@@ -1216,9 +1266,7 @@ module.exports = class ftx extends Exchange {
|
|||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {
|
const request = {};
|
||||||
'order_id': parseInt (id),
|
|
||||||
};
|
|
||||||
// support for canceling conditional orders
|
// support for canceling conditional orders
|
||||||
// https://github.com/ccxt/ccxt/issues/6669
|
// https://github.com/ccxt/ccxt/issues/6669
|
||||||
const options = this.safeValue (this.options, 'cancelOrder', {});
|
const options = this.safeValue (this.options, 'cancelOrder', {});
|
||||||
@@ -1251,8 +1299,8 @@ module.exports = class ftx extends Exchange {
|
|||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {
|
const request = {
|
||||||
// 'market': market['id'], // optional
|
// 'market': market['id'], // optional
|
||||||
'conditionalOrdersOnly': false, // cancel conditional orders only
|
// 'conditionalOrdersOnly': false, // cancel conditional orders only
|
||||||
'limitOrdersOnly': false, // cancel existing limit orders (non-conditional orders) only
|
// 'limitOrdersOnly': false, // cancel existing limit orders (non-conditional orders) only
|
||||||
};
|
};
|
||||||
const marketId = this.getMarketId (symbol, 'market', params);
|
const marketId = this.getMarketId (symbol, 'market', params);
|
||||||
if (marketId !== undefined) {
|
if (marketId !== undefined) {
|
||||||
@@ -1421,6 +1469,7 @@ module.exports = class ftx extends Exchange {
|
|||||||
}
|
}
|
||||||
if (since !== undefined) {
|
if (since !== undefined) {
|
||||||
request['start_time'] = parseInt (since / 1000);
|
request['start_time'] = parseInt (since / 1000);
|
||||||
|
request['end_time'] = this.seconds ();
|
||||||
}
|
}
|
||||||
const response = await this.privateGetFills (this.extend (request, params));
|
const response = await this.privateGetFills (this.extend (request, params));
|
||||||
//
|
//
|
||||||
@@ -1610,6 +1659,15 @@ module.exports = class ftx extends Exchange {
|
|||||||
// "txid": "0x8078356ae4b06a036d64747546c274af19581f1c78c510b60505798a7ffcaf1"
|
// "txid": "0x8078356ae4b06a036d64747546c274af19581f1c78c510b60505798a7ffcaf1"
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
// {
|
||||||
|
// "coin": 'BTC',
|
||||||
|
// "id": 1969806,
|
||||||
|
// "notes": 'Transfer to Dd6gi7m2Eg4zzBbPAxuwfEaHs6tYvyUX5hbPpsTcNPXo',
|
||||||
|
// "size": 0.003,
|
||||||
|
// "status": 'complete',
|
||||||
|
// "time": '2021-02-03T20:28:54.918146+00:00'
|
||||||
|
// }
|
||||||
|
//
|
||||||
const code = this.safeCurrencyCode (this.safeString (transaction, 'coin'));
|
const code = this.safeCurrencyCode (this.safeString (transaction, 'coin'));
|
||||||
const id = this.safeString (transaction, 'id');
|
const id = this.safeString (transaction, 'id');
|
||||||
const amount = this.safeFloat (transaction, 'size');
|
const amount = this.safeFloat (transaction, 'size');
|
||||||
@@ -1622,8 +1680,14 @@ module.exports = class ftx extends Exchange {
|
|||||||
tag = this.safeString (address, 'tag');
|
tag = this.safeString (address, 'tag');
|
||||||
address = this.safeString (address, 'address');
|
address = this.safeString (address, 'address');
|
||||||
}
|
}
|
||||||
|
if (address === undefined) {
|
||||||
|
// parse address from internal transfer
|
||||||
|
const notes = this.safeString (transaction, 'notes');
|
||||||
|
if (notes !== undefined) {
|
||||||
|
address = notes.slice (12);
|
||||||
|
}
|
||||||
|
}
|
||||||
const fee = this.safeFloat (transaction, 'fee');
|
const fee = this.safeFloat (transaction, 'fee');
|
||||||
const type = ('destinationName' in transaction) ? 'withdrawal' : 'deposit';
|
|
||||||
return {
|
return {
|
||||||
'info': transaction,
|
'info': transaction,
|
||||||
'id': id,
|
'id': id,
|
||||||
@@ -1636,7 +1700,7 @@ module.exports = class ftx extends Exchange {
|
|||||||
'tagFrom': undefined,
|
'tagFrom': undefined,
|
||||||
'tag': tag,
|
'tag': tag,
|
||||||
'tagTo': tag,
|
'tagTo': tag,
|
||||||
'type': type,
|
'type': undefined,
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
'currency': code,
|
'currency': code,
|
||||||
'status': status,
|
'status': status,
|
||||||
@@ -1674,7 +1738,7 @@ module.exports = class ftx extends Exchange {
|
|||||||
if (code !== undefined) {
|
if (code !== undefined) {
|
||||||
currency = this.currency (code);
|
currency = this.currency (code);
|
||||||
}
|
}
|
||||||
return this.parseTransactions (result, currency, since, limit);
|
return this.parseTransactions (result, currency, since, limit, { 'type': 'deposit' });
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
@@ -1701,7 +1765,7 @@ module.exports = class ftx extends Exchange {
|
|||||||
if (code !== undefined) {
|
if (code !== undefined) {
|
||||||
currency = this.currency (code);
|
currency = this.currency (code);
|
||||||
}
|
}
|
||||||
return this.parseTransactions (result, currency, since, limit);
|
return this.parseTransactions (result, currency, since, limit, { 'type': 'withdrawal' });
|
||||||
}
|
}
|
||||||
|
|
||||||
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
||||||
|
|||||||
Generated
Vendored
+29
-16
@@ -167,6 +167,7 @@ module.exports = class gateio extends Exchange {
|
|||||||
'BOX': 'DefiBox',
|
'BOX': 'DefiBox',
|
||||||
'BTCBEAR': 'BEAR',
|
'BTCBEAR': 'BEAR',
|
||||||
'BTCBULL': 'BULL',
|
'BTCBULL': 'BULL',
|
||||||
|
'SBTC': 'Super Bitcoin',
|
||||||
'TNC': 'Trinity Network Credit',
|
'TNC': 'Trinity Network Credit',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -690,6 +691,7 @@ module.exports = class gateio extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -730,7 +732,7 @@ module.exports = class gateio extends Exchange {
|
|||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {
|
const request = {
|
||||||
@@ -753,13 +755,13 @@ module.exports = class gateio extends Exchange {
|
|||||||
if ((address !== undefined) && (address.indexOf ('address') >= 0)) {
|
if ((address !== undefined) && (address.indexOf ('address') >= 0)) {
|
||||||
throw new InvalidAddress (this.id + ' queryDepositAddress ' + address);
|
throw new InvalidAddress (this.id + ' queryDepositAddress ' + address);
|
||||||
}
|
}
|
||||||
if (code === 'XRP') {
|
if ((code === 'XRP') || (code === 'HBAR') || (code === 'STEEM') || (code === 'XLM') || (code === 'EOS')) {
|
||||||
const parts = address.split (' ');
|
const parts = address.split (' ');
|
||||||
address = parts[0];
|
address = parts[0];
|
||||||
tag = parts[1];
|
tag = parts[1];
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
'currency': currency,
|
'currency': code,
|
||||||
'address': address,
|
'address': address,
|
||||||
'tag': tag,
|
'tag': tag,
|
||||||
'info': response,
|
'info': response,
|
||||||
@@ -786,7 +788,7 @@ module.exports = class gateio extends Exchange {
|
|||||||
|
|
||||||
async fetchOrderTrades (id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOrderTrades (id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrderTrades() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -800,7 +802,7 @@ module.exports = class gateio extends Exchange {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -882,21 +884,21 @@ module.exports = class gateio extends Exchange {
|
|||||||
// withdrawal
|
// withdrawal
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// 'id': 'w5864259',
|
// "id": "w6754336",
|
||||||
// 'currency': 'ETH',
|
// "fee": "0.1",
|
||||||
// 'address': '0x72632f462....',
|
// "txid": "zzyy",
|
||||||
// 'amount': '0.4947',
|
// "amount": "1",
|
||||||
// 'txid': '0x111167d120f736....',
|
// "status": "DONE",
|
||||||
// 'timestamp': '1553123688',
|
// "address": "tz11234",
|
||||||
// 'status': 'DONE',
|
// "currency": "XTZ",
|
||||||
// 'type': 'withdrawal'
|
// "timestamp": "1561030206"
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
const currencyId = this.safeString (transaction, 'currency');
|
const currencyId = this.safeString (transaction, 'currency');
|
||||||
const code = this.safeCurrencyCode (currencyId, currency);
|
const code = this.safeCurrencyCode (currencyId, currency);
|
||||||
const id = this.safeString (transaction, 'id');
|
const id = this.safeString (transaction, 'id');
|
||||||
const txid = this.safeString (transaction, 'txid');
|
const txid = this.safeString (transaction, 'txid');
|
||||||
const amount = this.safeFloat (transaction, 'amount');
|
let amount = this.safeFloat (transaction, 'amount');
|
||||||
let address = this.safeString (transaction, 'address');
|
let address = this.safeString (transaction, 'address');
|
||||||
if (address === 'false') {
|
if (address === 'false') {
|
||||||
address = undefined;
|
address = undefined;
|
||||||
@@ -904,6 +906,17 @@ module.exports = class gateio extends Exchange {
|
|||||||
const timestamp = this.safeTimestamp (transaction, 'timestamp');
|
const timestamp = this.safeTimestamp (transaction, 'timestamp');
|
||||||
const status = this.parseTransactionStatus (this.safeString (transaction, 'status'));
|
const status = this.parseTransactionStatus (this.safeString (transaction, 'status'));
|
||||||
const type = this.parseTransactionType (id[0]);
|
const type = this.parseTransactionType (id[0]);
|
||||||
|
const feeCost = this.safeFloat (transaction, 'fee');
|
||||||
|
let fee = undefined;
|
||||||
|
if (feeCost !== undefined) {
|
||||||
|
fee = {
|
||||||
|
'currency': code,
|
||||||
|
'cost': feeCost,
|
||||||
|
};
|
||||||
|
if (amount !== undefined) {
|
||||||
|
amount = amount - feeCost;
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
'info': transaction,
|
'info': transaction,
|
||||||
'id': id,
|
'id': id,
|
||||||
@@ -916,7 +929,7 @@ module.exports = class gateio extends Exchange {
|
|||||||
'type': type,
|
'type': type,
|
||||||
'timestamp': timestamp,
|
'timestamp': timestamp,
|
||||||
'datetime': this.iso8601 (timestamp),
|
'datetime': this.iso8601 (timestamp),
|
||||||
'fee': undefined,
|
'fee': fee,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Generated
Vendored
+2
-1
@@ -669,6 +669,7 @@ module.exports = class gemini extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -732,7 +733,7 @@ module.exports = class gemini extends Exchange {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
|
|||||||
Generated
Vendored
+1347
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+2
-1
@@ -841,7 +841,7 @@ module.exports = class hbtc extends Exchange {
|
|||||||
method = 'optionGetMyTrades';
|
method = 'optionGetMyTrades';
|
||||||
} else {
|
} else {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a `symbol` argument for ' + type + ' markets');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a `symbol` argument for ' + type + ' markets');
|
||||||
}
|
}
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
request['symbol'] = market['id'];
|
request['symbol'] = market['id'];
|
||||||
@@ -1954,6 +1954,7 @@ module.exports = class hbtc extends Exchange {
|
|||||||
'NEW': 'open',
|
'NEW': 'open',
|
||||||
'CANCELED': 'canceled',
|
'CANCELED': 'canceled',
|
||||||
'FILLED': 'closed',
|
'FILLED': 'closed',
|
||||||
|
'PARTIALLY_FILLED': 'open',
|
||||||
'PENDING_CANCEL': 'canceled',
|
'PENDING_CANCEL': 'canceled',
|
||||||
};
|
};
|
||||||
return this.safeString (statuses, status, status);
|
return this.safeString (statuses, status, status);
|
||||||
|
|||||||
Generated
Vendored
+43
-18
@@ -160,6 +160,7 @@ module.exports = class hitbtc extends Exchange {
|
|||||||
'LNC': 'LinkerCoin',
|
'LNC': 'LinkerCoin',
|
||||||
'PLA': 'PlayChip',
|
'PLA': 'PlayChip',
|
||||||
'PNT': 'Penta',
|
'PNT': 'Penta',
|
||||||
|
'SBTC': 'Super Bitcoin',
|
||||||
'TV': 'Tokenville',
|
'TV': 'Tokenville',
|
||||||
'USD': 'USDT',
|
'USD': 'USDT',
|
||||||
'XPNT': 'PNT',
|
'XPNT': 'PNT',
|
||||||
@@ -797,22 +798,44 @@ module.exports = class hitbtc extends Exchange {
|
|||||||
//
|
//
|
||||||
// createMarketOrder
|
// createMarketOrder
|
||||||
//
|
//
|
||||||
// { clientOrderId: "fe36aa5e190149bf9985fb673bbb2ea0",
|
// {
|
||||||
// createdAt: "2018-10-25T16:41:44.780Z",
|
// clientOrderId: "fe36aa5e190149bf9985fb673bbb2ea0",
|
||||||
// cumQuantity: "1",
|
// createdAt: "2018-10-25T16:41:44.780Z",
|
||||||
// id: "66799540063",
|
// cumQuantity: "1",
|
||||||
// quantity: "1",
|
// id: "66799540063",
|
||||||
// side: "sell",
|
// quantity: "1",
|
||||||
// status: "filled",
|
// side: "sell",
|
||||||
// symbol: "XRPUSDT",
|
// status: "filled",
|
||||||
// timeInForce: "FOK",
|
// symbol: "XRPUSDT",
|
||||||
// tradesReport: [ { fee: "0.0004644",
|
// timeInForce: "FOK",
|
||||||
// id: 386394956,
|
// tradesReport: [
|
||||||
// price: "0.4644",
|
// {
|
||||||
// quantity: "1",
|
// fee: "0.0004644",
|
||||||
// timestamp: "2018-10-25T16:41:44.780Z" } ],
|
// id: 386394956,
|
||||||
// type: "market",
|
// price: "0.4644",
|
||||||
// updatedAt: "2018-10-25T16:41:44.780Z" }
|
// quantity: "1",
|
||||||
|
// timestamp: "2018-10-25T16:41:44.780Z"
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// type: "market",
|
||||||
|
// updatedAt: "2018-10-25T16:41:44.780Z"
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "id": 119499457455,
|
||||||
|
// "clientOrderId": "87baab109d58401b9202fa0749cb8288",
|
||||||
|
// "symbol": "ETHUSD",
|
||||||
|
// "side": "buy",
|
||||||
|
// "status": "filled",
|
||||||
|
// "type": "market",
|
||||||
|
// "timeInForce": "FOK",
|
||||||
|
// "quantity": "0.0007",
|
||||||
|
// "price": "181.487",
|
||||||
|
// "avgPrice": "164.989",
|
||||||
|
// "cumQuantity": "0.0007",
|
||||||
|
// "createdAt": "2019-04-17T13:27:38.062Z",
|
||||||
|
// "updatedAt": "2019-04-17T13:27:38.062Z"
|
||||||
|
// }
|
||||||
//
|
//
|
||||||
const created = this.parse8601 (this.safeString (order, 'createdAt'));
|
const created = this.parse8601 (this.safeString (order, 'createdAt'));
|
||||||
const updated = this.parse8601 (this.safeString (order, 'updatedAt'));
|
const updated = this.parse8601 (this.safeString (order, 'updatedAt'));
|
||||||
@@ -842,7 +865,7 @@ module.exports = class hitbtc extends Exchange {
|
|||||||
const side = this.safeString (order, 'side');
|
const side = this.safeString (order, 'side');
|
||||||
let trades = this.safeValue (order, 'tradesReport');
|
let trades = this.safeValue (order, 'tradesReport');
|
||||||
let fee = undefined;
|
let fee = undefined;
|
||||||
let average = undefined;
|
let average = this.safeValue (order, 'avgPrice');
|
||||||
if (trades !== undefined) {
|
if (trades !== undefined) {
|
||||||
trades = this.parseTrades (trades, market);
|
trades = this.parseTrades (trades, market);
|
||||||
let feeCost = undefined;
|
let feeCost = undefined;
|
||||||
@@ -861,7 +884,9 @@ module.exports = class hitbtc extends Exchange {
|
|||||||
}
|
}
|
||||||
cost = tradesCost;
|
cost = tradesCost;
|
||||||
if ((filled !== undefined) && (filled > 0)) {
|
if ((filled !== undefined) && (filled > 0)) {
|
||||||
average = cost / filled;
|
if (average === undefined) {
|
||||||
|
average = cost / filled;
|
||||||
|
}
|
||||||
if (type === 'market') {
|
if (type === 'market') {
|
||||||
if (price === undefined) {
|
if (price === undefined) {
|
||||||
price = average;
|
price = average;
|
||||||
|
|||||||
Generated
Vendored
+2
-1
@@ -520,7 +520,7 @@ module.exports = class hollaex extends Exchange {
|
|||||||
const duration = this.parseTimeframe (timeframe);
|
const duration = this.parseTimeframe (timeframe);
|
||||||
if (since === undefined) {
|
if (since === undefined) {
|
||||||
if (limit === undefined) {
|
if (limit === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + " fetchOHLCV requires a 'since' or a 'limit' argument");
|
throw new ArgumentsRequired (this.id + " fetchOHLCV() requires a 'since' or a 'limit' argument");
|
||||||
} else {
|
} else {
|
||||||
const end = this.seconds ();
|
const end = this.seconds ();
|
||||||
const start = end - duration * limit;
|
const start = end - duration * limit;
|
||||||
@@ -702,6 +702,7 @@ module.exports = class hollaex extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+15
-3
@@ -98,6 +98,7 @@ module.exports = class huobipro extends Exchange {
|
|||||||
'user/api-key', // 母子用户API key信息查询
|
'user/api-key', // 母子用户API key信息查询
|
||||||
],
|
],
|
||||||
'post': [
|
'post': [
|
||||||
|
'account/transfer',
|
||||||
'point/transfer', // 点卡划转
|
'point/transfer', // 点卡划转
|
||||||
'sub-user/management', // 冻结/解冻子用户
|
'sub-user/management', // 冻结/解冻子用户
|
||||||
'sub-user/creation', // 子用户创建
|
'sub-user/creation', // 子用户创建
|
||||||
@@ -195,9 +196,14 @@ module.exports = class huobipro extends Exchange {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
'exceptions': {
|
'exceptions': {
|
||||||
|
'broad': {
|
||||||
|
'contract is restricted of closing positions on API. Please contact customer service': OnMaintenance,
|
||||||
|
'maintain': OnMaintenance,
|
||||||
|
},
|
||||||
'exact': {
|
'exact': {
|
||||||
// err-code
|
// err-code
|
||||||
'bad-request': BadRequest,
|
'bad-request': BadRequest,
|
||||||
|
'base-date-limit-error': BadRequest, // {"status":"error","err-code":"base-date-limit-error","err-msg":"date less than system limit","data":null}
|
||||||
'api-not-support-temp-addr': PermissionDenied, // {"status":"error","err-code":"api-not-support-temp-addr","err-msg":"API withdrawal does not support temporary addresses","data":null}
|
'api-not-support-temp-addr': PermissionDenied, // {"status":"error","err-code":"api-not-support-temp-addr","err-msg":"API withdrawal does not support temporary addresses","data":null}
|
||||||
'timeout': RequestTimeout, // {"ts":1571653730865,"status":"error","err-code":"timeout","err-msg":"Request Timeout"}
|
'timeout': RequestTimeout, // {"ts":1571653730865,"status":"error","err-code":"timeout","err-msg":"Request Timeout"}
|
||||||
'gateway-internal-error': ExchangeNotAvailable, // {"status":"error","err-code":"gateway-internal-error","err-msg":"Failed to load data. Try again later.","data":null}
|
'gateway-internal-error': ExchangeNotAvailable, // {"status":"error","err-code":"gateway-internal-error","err-msg":"Failed to load data. Try again later.","data":null}
|
||||||
@@ -208,6 +214,8 @@ module.exports = class huobipro extends Exchange {
|
|||||||
'order-marketorder-amount-min-error': InvalidOrder, // market order amount error, min: `0.01`
|
'order-marketorder-amount-min-error': InvalidOrder, // market order amount error, min: `0.01`
|
||||||
'order-limitorder-price-min-error': InvalidOrder, // limit order price error
|
'order-limitorder-price-min-error': InvalidOrder, // limit order price error
|
||||||
'order-limitorder-price-max-error': InvalidOrder, // limit order price error
|
'order-limitorder-price-max-error': InvalidOrder, // limit order price error
|
||||||
|
'order-holding-limit-failed': InvalidOrder, // {"status":"error","err-code":"order-holding-limit-failed","err-msg":"Order failed, exceeded the holding limit of this currency","data":null}
|
||||||
|
'order-orderprice-precision-error': InvalidOrder, // {"status":"error","err-code":"order-orderprice-precision-error","err-msg":"order price precision error, scale: `4`","data":null}
|
||||||
'order-orderstate-error': OrderNotFound, // canceling an already canceled order
|
'order-orderstate-error': OrderNotFound, // canceling an already canceled order
|
||||||
'order-queryorder-invalid': OrderNotFound, // querying a non-existent order
|
'order-queryorder-invalid': OrderNotFound, // querying a non-existent order
|
||||||
'order-update-error': ExchangeNotAvailable, // undocumented error
|
'order-update-error': ExchangeNotAvailable, // undocumented error
|
||||||
@@ -243,6 +251,7 @@ module.exports = class huobipro extends Exchange {
|
|||||||
// https://coinmarketcap.com/currencies/penta/markets/
|
// https://coinmarketcap.com/currencies/penta/markets/
|
||||||
// https://en.cryptonomist.ch/blog/eidoo/the-edo-to-pnt-upgrade-what-you-need-to-know-updated/
|
// https://en.cryptonomist.ch/blog/eidoo/the-edo-to-pnt-upgrade-what-you-need-to-know-updated/
|
||||||
'PNT': 'Penta',
|
'PNT': 'Penta',
|
||||||
|
'SBTC': 'Super Bitcoin',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -675,7 +684,8 @@ module.exports = class huobipro extends Exchange {
|
|||||||
request['size'] = limit; // 1-100 orders, default is 100
|
request['size'] = limit; // 1-100 orders, default is 100
|
||||||
}
|
}
|
||||||
if (since !== undefined) {
|
if (since !== undefined) {
|
||||||
request['start-date'] = this.ymd (since); // maximum query window size is 2 days, query window shift should be within past 120 days
|
request['start-date'] = this.ymd (since); // a date within 61 days from today
|
||||||
|
request['end-date'] = this.ymd (this.sum (since, 86400000));
|
||||||
}
|
}
|
||||||
const response = await this.privateGetOrderMatchresults (this.extend (request, params));
|
const response = await this.privateGetOrderMatchresults (this.extend (request, params));
|
||||||
const trades = this.parseTrades (response['data'], market, since, limit);
|
const trades = this.parseTrades (response['data'], market, since, limit);
|
||||||
@@ -943,7 +953,7 @@ module.exports = class huobipro extends Exchange {
|
|||||||
|
|
||||||
async fetchOpenOrdersV1 (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOpenOrdersV1 (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOpenOrdersV1 requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOpenOrdersV1() requires a symbol argument');
|
||||||
}
|
}
|
||||||
return await this.fetchOrdersByStates ('pre-submitted,submitted,partial-filled', symbol, since, limit, params);
|
return await this.fetchOrdersByStates ('pre-submitted,submitted,partial-filled', symbol, since, limit, params);
|
||||||
}
|
}
|
||||||
@@ -955,7 +965,7 @@ module.exports = class huobipro extends Exchange {
|
|||||||
async fetchOpenOrdersV2 (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOpenOrdersV2 (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOpenOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOpenOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
let accountId = this.safeString (params, 'account-id');
|
let accountId = this.safeString (params, 'account-id');
|
||||||
@@ -1105,6 +1115,7 @@ module.exports = class huobipro extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -1484,6 +1495,7 @@ module.exports = class huobipro extends Exchange {
|
|||||||
if (status === 'error') {
|
if (status === 'error') {
|
||||||
const code = this.safeString (response, 'err-code');
|
const code = this.safeString (response, 'err-code');
|
||||||
const feedback = this.id + ' ' + body;
|
const feedback = this.id + ' ' + body;
|
||||||
|
this.throwBroadlyMatchedException (this.exceptions['broad'], body, feedback);
|
||||||
this.throwExactlyMatchedException (this.exceptions['exact'], code, feedback);
|
this.throwExactlyMatchedException (this.exceptions['exact'], code, feedback);
|
||||||
const message = this.safeString (response, 'err-msg');
|
const message = this.safeString (response, 'err-msg');
|
||||||
this.throwExactlyMatchedException (this.exceptions['exact'], message, feedback);
|
this.throwExactlyMatchedException (this.exceptions['exact'], message, feedback);
|
||||||
|
|||||||
Generated
Vendored
+2
-1
@@ -225,7 +225,7 @@ module.exports = class ice3x extends Exchange {
|
|||||||
const type = this.safeString (params, 'type');
|
const type = this.safeString (params, 'type');
|
||||||
if ((type !== 'ask') && (type !== 'bid')) {
|
if ((type !== 'ask') && (type !== 'bid')) {
|
||||||
// eslint-disable-next-line quotes
|
// eslint-disable-next-line quotes
|
||||||
throw new ArgumentsRequired (this.id + " fetchOrderBook requires an exchange-specific extra 'type' param ('bid' or 'ask') when used with a limit");
|
throw new ArgumentsRequired (this.id + " fetchOrderBook() requires an exchange-specific extra 'type' param ('bid' or 'ask') when used with a limit");
|
||||||
} else {
|
} else {
|
||||||
request['items_per_page'] = limit;
|
request['items_per_page'] = limit;
|
||||||
}
|
}
|
||||||
@@ -345,6 +345,7 @@ module.exports = class ice3x extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': this.safeString (order, 'type'),
|
'side': this.safeString (order, 'type'),
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Generated
Vendored
+8
-4
@@ -56,8 +56,8 @@ module.exports = class idex extends Exchange {
|
|||||||
},
|
},
|
||||||
'logo': 'https://user-images.githubusercontent.com/51840849/94481303-2f222100-01e0-11eb-97dd-bc14c5943a86.jpg',
|
'logo': 'https://user-images.githubusercontent.com/51840849/94481303-2f222100-01e0-11eb-97dd-bc14c5943a86.jpg',
|
||||||
'api': {
|
'api': {
|
||||||
'public': 'https://api.idex.io',
|
'ETH': 'https://api-eth.idex.io',
|
||||||
'private': 'https://api.idex.io',
|
'BSC': 'https://api-bsc.idex.io',
|
||||||
},
|
},
|
||||||
'www': 'https://idex.io',
|
'www': 'https://idex.io',
|
||||||
'doc': [
|
'doc': [
|
||||||
@@ -103,6 +103,7 @@ module.exports = class idex extends Exchange {
|
|||||||
'options': {
|
'options': {
|
||||||
'defaultTimeInForce': 'gtc',
|
'defaultTimeInForce': 'gtc',
|
||||||
'defaultSelfTradePrevention': 'cn',
|
'defaultSelfTradePrevention': 'cn',
|
||||||
|
'network': 'ETH', // also supports BSC
|
||||||
},
|
},
|
||||||
'exceptions': {
|
'exceptions': {
|
||||||
'INVALID_ORDER_QUANTITY': InvalidOrder,
|
'INVALID_ORDER_QUANTITY': InvalidOrder,
|
||||||
@@ -855,6 +856,7 @@ module.exports = class idex extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -943,7 +945,8 @@ module.exports = class idex extends Exchange {
|
|||||||
}
|
}
|
||||||
const sideEnum = (side === 'buy') ? 0 : 1;
|
const sideEnum = (side === 'buy') ? 0 : 1;
|
||||||
const walletBytes = this.remove0xPrefix (this.walletAddress);
|
const walletBytes = this.remove0xPrefix (this.walletAddress);
|
||||||
const orderVersion = 1;
|
const network = this.safeString (this.options, 'network', 'ETH');
|
||||||
|
const orderVersion = (network === 'ETH') ? 1 : 2;
|
||||||
const amountString = this.amountToPrecision (symbol, amount);
|
const amountString = this.amountToPrecision (symbol, amount);
|
||||||
// https://docs.idex.io/#time-in-force
|
// https://docs.idex.io/#time-in-force
|
||||||
const timeInForceEnums = {
|
const timeInForceEnums = {
|
||||||
@@ -1272,8 +1275,9 @@ module.exports = class idex extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
||||||
|
const network = this.safeString (this.options, 'network', 'ETH');
|
||||||
const version = this.safeString (this.options, 'version', 'v1');
|
const version = this.safeString (this.options, 'version', 'v1');
|
||||||
let url = this.urls['api'][api] + '/' + version + '/' + path;
|
let url = this.urls['api'][network] + '/' + version + '/' + path;
|
||||||
const keys = Object.keys (params);
|
const keys = Object.keys (params);
|
||||||
const length = keys.length;
|
const length = keys.length;
|
||||||
let query = undefined;
|
let query = undefined;
|
||||||
|
|||||||
Generated
Vendored
+7
-3
@@ -287,6 +287,7 @@ module.exports = class independentreserve extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': orderType,
|
'type': orderType,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -394,10 +395,13 @@ module.exports = class independentreserve extends Exchange {
|
|||||||
cost = price * amount;
|
cost = price * amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let symbol = undefined;
|
const baseId = this.safeString (trade, 'PrimaryCurrencyCode');
|
||||||
if (market !== undefined) {
|
const quoteId = this.safeString (trade, 'SecondaryCurrencyCode');
|
||||||
symbol = market['symbol'];
|
let marketId = undefined;
|
||||||
|
if ((baseId !== undefined) && (quoteId !== undefined)) {
|
||||||
|
marketId = baseId + '/' + quoteId;
|
||||||
}
|
}
|
||||||
|
const symbol = this.safeSymbol (marketId, market, '/');
|
||||||
let side = this.safeString (trade, 'OrderType');
|
let side = this.safeString (trade, 'OrderType');
|
||||||
if (side !== undefined) {
|
if (side !== undefined) {
|
||||||
if (side.indexOf ('Bid') >= 0) {
|
if (side.indexOf ('Bid') >= 0) {
|
||||||
|
|||||||
Generated
Vendored
+5
-4
@@ -399,6 +399,7 @@ module.exports = class indodax extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -415,7 +416,7 @@ module.exports = class indodax extends Exchange {
|
|||||||
|
|
||||||
async fetchOrder (id, symbol = undefined, params = {}) {
|
async fetchOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrder requires a symbol');
|
throw new ArgumentsRequired (this.id + ' fetchOrder() requires a symbol');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -462,7 +463,7 @@ module.exports = class indodax extends Exchange {
|
|||||||
|
|
||||||
async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {};
|
const request = {};
|
||||||
@@ -506,11 +507,11 @@ module.exports = class indodax extends Exchange {
|
|||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a symbol argument');
|
||||||
}
|
}
|
||||||
const side = this.safeValue (params, 'side');
|
const side = this.safeValue (params, 'side');
|
||||||
if (side === undefined) {
|
if (side === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelOrder requires an extra "side" param');
|
throw new ArgumentsRequired (this.id + ' cancelOrder() requires an extra "side" param');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
|
|||||||
Generated
Vendored
+10
-7
@@ -268,7 +268,7 @@ module.exports = class itbit extends Exchange {
|
|||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const walletId = this.safeString (params, 'walletId');
|
const walletId = this.safeString (params, 'walletId');
|
||||||
if (walletId === undefined) {
|
if (walletId === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a walletId parameter');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a walletId parameter');
|
||||||
}
|
}
|
||||||
const request = {
|
const request = {
|
||||||
'walletId': walletId,
|
'walletId': walletId,
|
||||||
@@ -337,7 +337,7 @@ module.exports = class itbit extends Exchange {
|
|||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const walletId = this.safeString (params, 'walletId');
|
const walletId = this.safeString (params, 'walletId');
|
||||||
if (walletId === undefined) {
|
if (walletId === undefined) {
|
||||||
throw new ExchangeError (this.id + ' fetchMyTrades requires a walletId parameter');
|
throw new ExchangeError (this.id + ' fetchMyTrades() requires a walletId parameter');
|
||||||
}
|
}
|
||||||
const request = {
|
const request = {
|
||||||
'walletId': walletId,
|
'walletId': walletId,
|
||||||
@@ -427,7 +427,7 @@ module.exports = class itbit extends Exchange {
|
|||||||
async fetchWallets (params = {}) {
|
async fetchWallets (params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
if (!this.uid) {
|
if (!this.uid) {
|
||||||
throw new AuthenticationError (this.id + ' fetchWallets requires uid API credential');
|
throw new AuthenticationError (this.id + ' fetchWallets() requires uid API credential');
|
||||||
}
|
}
|
||||||
const request = {
|
const request = {
|
||||||
'userId': this.uid,
|
'userId': this.uid,
|
||||||
@@ -465,7 +465,7 @@ module.exports = class itbit extends Exchange {
|
|||||||
}
|
}
|
||||||
const walletIdInParams = ('walletId' in params);
|
const walletIdInParams = ('walletId' in params);
|
||||||
if (!walletIdInParams) {
|
if (!walletIdInParams) {
|
||||||
throw new ExchangeError (this.id + ' fetchOrders requires a walletId parameter');
|
throw new ExchangeError (this.id + ' fetchOrders() requires a walletId parameter');
|
||||||
}
|
}
|
||||||
const walletId = params['walletId'];
|
const walletId = params['walletId'];
|
||||||
const request = {
|
const request = {
|
||||||
@@ -529,6 +529,8 @@ module.exports = class itbit extends Exchange {
|
|||||||
}
|
}
|
||||||
const clientOrderId = this.safeString (order, 'clientOrderIdentifier');
|
const clientOrderId = this.safeString (order, 'clientOrderIdentifier');
|
||||||
const id = this.safeString (order, 'id');
|
const id = this.safeString (order, 'id');
|
||||||
|
const postOnlyString = this.safeString (order, 'postOnly');
|
||||||
|
const postOnly = (postOnlyString === 'True');
|
||||||
return {
|
return {
|
||||||
'id': id,
|
'id': id,
|
||||||
'clientOrderId': clientOrderId,
|
'clientOrderId': clientOrderId,
|
||||||
@@ -540,6 +542,7 @@ module.exports = class itbit extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': postOnly,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -565,7 +568,7 @@ module.exports = class itbit extends Exchange {
|
|||||||
}
|
}
|
||||||
const walletIdInParams = ('walletId' in params);
|
const walletIdInParams = ('walletId' in params);
|
||||||
if (!walletIdInParams) {
|
if (!walletIdInParams) {
|
||||||
throw new ExchangeError (this.id + ' createOrder requires a walletId parameter');
|
throw new ExchangeError (this.id + ' createOrder() requires a walletId parameter');
|
||||||
}
|
}
|
||||||
amount = amount.toString ();
|
amount = amount.toString ();
|
||||||
price = price.toString ();
|
price = price.toString ();
|
||||||
@@ -590,7 +593,7 @@ module.exports = class itbit extends Exchange {
|
|||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const walletIdInParams = ('walletId' in params);
|
const walletIdInParams = ('walletId' in params);
|
||||||
if (!walletIdInParams) {
|
if (!walletIdInParams) {
|
||||||
throw new ExchangeError (this.id + ' fetchOrder requires a walletId parameter');
|
throw new ExchangeError (this.id + ' fetchOrder() requires a walletId parameter');
|
||||||
}
|
}
|
||||||
const request = {
|
const request = {
|
||||||
'id': id,
|
'id': id,
|
||||||
@@ -602,7 +605,7 @@ module.exports = class itbit extends Exchange {
|
|||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
const walletIdInParams = ('walletId' in params);
|
const walletIdInParams = ('walletId' in params);
|
||||||
if (!walletIdInParams) {
|
if (!walletIdInParams) {
|
||||||
throw new ExchangeError (this.id + ' cancelOrder requires a walletId parameter');
|
throw new ExchangeError (this.id + ' cancelOrder() requires a walletId parameter');
|
||||||
}
|
}
|
||||||
const request = {
|
const request = {
|
||||||
'id': id,
|
'id': id,
|
||||||
|
|||||||
Generated
Vendored
+133
-20
@@ -3,7 +3,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const Exchange = require ('./base/Exchange');
|
const Exchange = require ('./base/Exchange');
|
||||||
const { BadSymbol, ExchangeNotAvailable, ArgumentsRequired, PermissionDenied, AuthenticationError, ExchangeError, OrderNotFound, DDoSProtection, InvalidNonce, InsufficientFunds, CancelPending, InvalidOrder, InvalidAddress } = require ('./base/errors');
|
const { BadSymbol, ExchangeNotAvailable, ArgumentsRequired, PermissionDenied, AuthenticationError, ExchangeError, OrderNotFound, DDoSProtection, InvalidNonce, InsufficientFunds, CancelPending, InvalidOrder, InvalidAddress, RateLimitExceeded } = require ('./base/errors');
|
||||||
const { TRUNCATE, DECIMAL_PLACES } = require ('./base/functions/number');
|
const { TRUNCATE, DECIMAL_PLACES } = require ('./base/functions/number');
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -19,6 +19,7 @@ module.exports = class kraken extends Exchange {
|
|||||||
'certified': true,
|
'certified': true,
|
||||||
'pro': true,
|
'pro': true,
|
||||||
'has': {
|
'has': {
|
||||||
|
'cancelAllOrders': true,
|
||||||
'cancelOrder': true,
|
'cancelOrder': true,
|
||||||
'CORS': false,
|
'CORS': false,
|
||||||
'createDepositAddress': true,
|
'createDepositAddress': true,
|
||||||
@@ -179,6 +180,7 @@ module.exports = class kraken extends Exchange {
|
|||||||
'AddOrder',
|
'AddOrder',
|
||||||
'AddExport',
|
'AddExport',
|
||||||
'Balance',
|
'Balance',
|
||||||
|
'CancelAll',
|
||||||
'CancelOrder',
|
'CancelOrder',
|
||||||
'ClosedOrders',
|
'ClosedOrders',
|
||||||
'DepositAddresses',
|
'DepositAddresses',
|
||||||
@@ -206,6 +208,7 @@ module.exports = class kraken extends Exchange {
|
|||||||
},
|
},
|
||||||
'commonCurrencies': {
|
'commonCurrencies': {
|
||||||
'XBT': 'BTC',
|
'XBT': 'BTC',
|
||||||
|
'XBT.M': 'BTC.M', // https://support.kraken.com/hc/en-us/articles/360039879471-What-is-Asset-S-and-Asset-M-
|
||||||
'XDG': 'DOGE',
|
'XDG': 'DOGE',
|
||||||
'REPV2': 'REP',
|
'REPV2': 'REP',
|
||||||
'REP': 'REPV1',
|
'REP': 'REPV1',
|
||||||
@@ -349,13 +352,17 @@ module.exports = class kraken extends Exchange {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
safeCurrencyCode (currencyId, currency = undefined) {
|
safeCurrency (currencyId, currency = undefined) {
|
||||||
if (currencyId.length > 3) {
|
if (currencyId.length > 3) {
|
||||||
if ((currencyId.indexOf ('X') === 0) || (currencyId.indexOf ('Z') === 0)) {
|
if ((currencyId.indexOf ('X') === 0) || (currencyId.indexOf ('Z') === 0)) {
|
||||||
currencyId = currencyId.slice (1);
|
if (currencyId.indexOf ('.') > 0) {
|
||||||
|
return super.safeCurrency (currencyId, currency);
|
||||||
|
} else {
|
||||||
|
currencyId = currencyId.slice (1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.safeCurrencyCode (currencyId, currency);
|
return super.safeCurrency (currencyId, currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
appendInactiveMarkets (result) {
|
appendInactiveMarkets (result) {
|
||||||
@@ -820,7 +827,7 @@ module.exports = class kraken extends Exchange {
|
|||||||
let amount = undefined;
|
let amount = undefined;
|
||||||
let cost = undefined;
|
let cost = undefined;
|
||||||
let id = undefined;
|
let id = undefined;
|
||||||
let order = undefined;
|
let orderId = undefined;
|
||||||
let fee = undefined;
|
let fee = undefined;
|
||||||
let symbol = undefined;
|
let symbol = undefined;
|
||||||
if (Array.isArray (trade)) {
|
if (Array.isArray (trade)) {
|
||||||
@@ -844,7 +851,7 @@ module.exports = class kraken extends Exchange {
|
|||||||
// delisted market ids go here
|
// delisted market ids go here
|
||||||
market = this.getDelistedMarketById (marketId);
|
market = this.getDelistedMarketById (marketId);
|
||||||
}
|
}
|
||||||
order = trade['ordertxid'];
|
orderId = this.safeString (trade, 'ordertxid');
|
||||||
id = this.safeString2 (trade, 'id', 'postxid');
|
id = this.safeString2 (trade, 'id', 'postxid');
|
||||||
timestamp = this.safeTimestamp (trade, 'time');
|
timestamp = this.safeTimestamp (trade, 'time');
|
||||||
side = this.safeString (trade, 'type');
|
side = this.safeString (trade, 'type');
|
||||||
@@ -872,7 +879,7 @@ module.exports = class kraken extends Exchange {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
'id': id,
|
'id': id,
|
||||||
'order': order,
|
'order': orderId,
|
||||||
'info': trade,
|
'info': trade,
|
||||||
'timestamp': timestamp,
|
'timestamp': timestamp,
|
||||||
'datetime': this.iso8601 (timestamp),
|
'datetime': this.iso8601 (timestamp),
|
||||||
@@ -935,6 +942,7 @@ module.exports = class kraken extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchBalance (params = {}) {
|
async fetchBalance (params = {}) {
|
||||||
|
await this.loadMarkets ();
|
||||||
const response = await this.privatePostBalance (params);
|
const response = await this.privatePostBalance (params);
|
||||||
const balances = this.safeValue (response, 'result', {});
|
const balances = this.safeValue (response, 'result', {});
|
||||||
const result = { 'info': balances };
|
const result = { 'info': balances };
|
||||||
@@ -959,18 +967,50 @@ module.exports = class kraken extends Exchange {
|
|||||||
'volume': this.amountToPrecision (symbol, amount),
|
'volume': this.amountToPrecision (symbol, amount),
|
||||||
};
|
};
|
||||||
const clientOrderId = this.safeString2 (params, 'userref', 'clientOrderId');
|
const clientOrderId = this.safeString2 (params, 'userref', 'clientOrderId');
|
||||||
const query = this.omit (params, [ 'userref', 'clientOrderId' ]);
|
params = this.omit (params, [ 'userref', 'clientOrderId' ]);
|
||||||
if (clientOrderId !== undefined) {
|
if (clientOrderId !== undefined) {
|
||||||
request['userref'] = clientOrderId;
|
request['userref'] = clientOrderId;
|
||||||
}
|
}
|
||||||
const priceIsDefined = (price !== undefined);
|
//
|
||||||
const marketOrder = (type === 'market');
|
// market
|
||||||
const limitOrder = (type === 'limit');
|
// limit (price = limit price)
|
||||||
const shouldIncludePrice = limitOrder || (!marketOrder && priceIsDefined);
|
// stop-loss (price = stop loss price)
|
||||||
if (shouldIncludePrice) {
|
// take-profit (price = take profit price)
|
||||||
|
// stop-loss-limit (price = stop loss trigger price, price2 = triggered limit price)
|
||||||
|
// take-profit-limit (price = take profit trigger price, price2 = triggered limit price)
|
||||||
|
// settle-position
|
||||||
|
//
|
||||||
|
if (type === 'limit') {
|
||||||
request['price'] = this.priceToPrecision (symbol, price);
|
request['price'] = this.priceToPrecision (symbol, price);
|
||||||
|
} else if ((type === 'stop-loss') || (type === 'take-profit')) {
|
||||||
|
const stopPrice = this.safeFloat2 (params, 'price', 'stopPrice', price);
|
||||||
|
if (stopPrice === undefined) {
|
||||||
|
throw new ArgumentsRequired (this.id + ' createOrder() requires a price argument or a price/stopPrice parameter for a ' + type + ' order');
|
||||||
|
} else {
|
||||||
|
request['price'] = this.priceToPrecision (symbol, stopPrice);
|
||||||
|
}
|
||||||
|
} else if ((type === 'stop-loss-limit') || (type === 'take-profit-limit')) {
|
||||||
|
const stopPrice = this.safeFloat2 (params, 'price', 'stopPrice');
|
||||||
|
const limitPrice = this.safeFloat (params, 'price2');
|
||||||
|
const stopPriceDefined = (stopPrice !== undefined);
|
||||||
|
const limitPriceDefined = (limitPrice !== undefined);
|
||||||
|
if (stopPriceDefined && limitPriceDefined) {
|
||||||
|
request['price'] = this.priceToPrecision (symbol, stopPrice);
|
||||||
|
request['price2'] = this.priceToPrecision (symbol, limitPrice);
|
||||||
|
} else if ((price === undefined) || (!(stopPriceDefined || limitPriceDefined))) {
|
||||||
|
throw new ArgumentsRequired (this.id + ' createOrder() requires a price argument and/or price/stopPrice/price2 parameters for a ' + type + ' order');
|
||||||
|
} else {
|
||||||
|
if (stopPriceDefined) {
|
||||||
|
request['price'] = this.priceToPrecision (symbol, stopPrice);
|
||||||
|
request['price2'] = this.priceToPrecision (symbol, price);
|
||||||
|
} else if (limitPriceDefined) {
|
||||||
|
request['price'] = this.priceToPrecision (symbol, price);
|
||||||
|
request['price2'] = this.priceToPrecision (symbol, limitPrice);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const response = await this.privatePostAddOrder (this.extend (request, query));
|
params = this.omit (params, [ 'price', 'stopPrice', 'price2' ]);
|
||||||
|
const response = await this.privatePostAddOrder (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// error: [],
|
// error: [],
|
||||||
@@ -1133,6 +1173,7 @@ module.exports = class kraken extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': stopPrice,
|
'stopPrice': stopPrice,
|
||||||
@@ -1199,8 +1240,11 @@ module.exports = class kraken extends Exchange {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
const orders = this.safeValue (response, 'result', []);
|
const result = this.safeValue (response, 'result', []);
|
||||||
const order = this.parseOrder (this.extend ({ 'id': id }, orders[id]));
|
if (!(id in result)) {
|
||||||
|
throw new OrderNotFound (this.id + ' fetchOrder() could not find order id ' + id);
|
||||||
|
}
|
||||||
|
const order = this.parseOrder (this.extend ({ 'id': id }, result[id]));
|
||||||
return this.extend ({ 'info': response }, order);
|
return this.extend ({ 'info': response }, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1208,7 +1252,7 @@ module.exports = class kraken extends Exchange {
|
|||||||
const orderTrades = this.safeValue (params, 'trades');
|
const orderTrades = this.safeValue (params, 'trades');
|
||||||
const tradeIds = [];
|
const tradeIds = [];
|
||||||
if (orderTrades === undefined) {
|
if (orderTrades === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + " fetchOrderTrades requires a unified order structure in the params argument or a 'trades' param (an array of trade id strings)");
|
throw new ArgumentsRequired (this.id + " fetchOrderTrades() requires a unified order structure in the params argument or a 'trades' param (an array of trade id strings)");
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < orderTrades.length; i++) {
|
for (let i = 0; i < orderTrades.length; i++) {
|
||||||
const orderTrade = orderTrades[i];
|
const orderTrade = orderTrades[i];
|
||||||
@@ -1357,6 +1401,11 @@ module.exports = class kraken extends Exchange {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async cancelAllOrders (symbol = undefined, params = {}) {
|
||||||
|
await this.loadMarkets ();
|
||||||
|
return await this.privatePostCancelAll (params);
|
||||||
|
}
|
||||||
|
|
||||||
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const request = {};
|
const request = {};
|
||||||
@@ -1528,7 +1577,7 @@ module.exports = class kraken extends Exchange {
|
|||||||
async fetchDeposits (code = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchDeposits (code = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
// https://www.kraken.com/en-us/help/api#deposit-status
|
// https://www.kraken.com/en-us/help/api#deposit-status
|
||||||
if (code === undefined) {
|
if (code === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchDeposits requires a currency code argument');
|
throw new ArgumentsRequired (this.id + ' fetchDeposits() requires a currency code argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const currency = this.currency (code);
|
const currency = this.currency (code);
|
||||||
@@ -1571,7 +1620,7 @@ module.exports = class kraken extends Exchange {
|
|||||||
async fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
// https://www.kraken.com/en-us/help/api#withdraw-status
|
// https://www.kraken.com/en-us/help/api#withdraw-status
|
||||||
if (code === undefined) {
|
if (code === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchWithdrawals requires a currency code argument');
|
throw new ArgumentsRequired (this.id + ' fetchWithdrawals() requires a currency code argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const currency = this.currency (code);
|
const currency = this.currency (code);
|
||||||
@@ -1662,7 +1711,65 @@ module.exports = class kraken extends Exchange {
|
|||||||
'id': response['result'],
|
'id': response['result'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
throw new ExchangeError (this.id + " withdraw requires a 'key' parameter (withdrawal key name, as set up on your account)");
|
throw new ExchangeError (this.id + " withdraw() requires a 'key' parameter (withdrawal key name, as set up on your account)");
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchPositions (symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
|
await this.loadMarkets ();
|
||||||
|
const request = {
|
||||||
|
// 'txid': 'comma delimited list of transaction ids to restrict output to',
|
||||||
|
// 'docalcs': false, // whether or not to include profit/loss calculations
|
||||||
|
// 'consolidation': 'market', // what to consolidate the positions data around, market will consolidate positions based on market pair
|
||||||
|
};
|
||||||
|
const response = await this.privatePostOpenPositions (this.extend (request, params));
|
||||||
|
//
|
||||||
|
// no consolidation
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// error: [],
|
||||||
|
// result: {
|
||||||
|
// 'TGUFMY-FLESJ-VYIX3J': {
|
||||||
|
// ordertxid: "O3LRNU-ZKDG5-XNCDFR",
|
||||||
|
// posstatus: "open",
|
||||||
|
// pair: "ETHUSDT",
|
||||||
|
// time: 1611557231.4584,
|
||||||
|
// type: "buy",
|
||||||
|
// ordertype: "market",
|
||||||
|
// cost: "28.49800",
|
||||||
|
// fee: "0.07979",
|
||||||
|
// vol: "0.02000000",
|
||||||
|
// vol_closed: "0.00000000",
|
||||||
|
// margin: "14.24900",
|
||||||
|
// terms: "0.0200% per 4 hours",
|
||||||
|
// rollovertm: "1611571631",
|
||||||
|
// misc: "",
|
||||||
|
// oflags: ""
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// consolidation by market
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// error: [],
|
||||||
|
// result: [
|
||||||
|
// {
|
||||||
|
// pair: "ETHUSDT",
|
||||||
|
// positions: "1",
|
||||||
|
// type: "buy",
|
||||||
|
// leverage: "2.00000",
|
||||||
|
// cost: "28.49800",
|
||||||
|
// fee: "0.07979",
|
||||||
|
// vol: "0.02000000",
|
||||||
|
// vol_closed: "0.00000000",
|
||||||
|
// margin: "14.24900"
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
const result = this.safeValue (response, 'result');
|
||||||
|
// todo unify parsePosition/parsePositions
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
||||||
@@ -1717,6 +1824,12 @@ module.exports = class kraken extends Exchange {
|
|||||||
if (body.indexOf ('Invalid arguments:volume') >= 0) {
|
if (body.indexOf ('Invalid arguments:volume') >= 0) {
|
||||||
throw new InvalidOrder (this.id + ' ' + body);
|
throw new InvalidOrder (this.id + ' ' + body);
|
||||||
}
|
}
|
||||||
|
if (body.indexOf ('Rate limit exceeded') >= 0) {
|
||||||
|
throw new RateLimitExceeded (this.id + ' ' + body);
|
||||||
|
}
|
||||||
|
if (response === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (body[0] === '{') {
|
if (body[0] === '{') {
|
||||||
if (typeof response !== 'string') {
|
if (typeof response !== 'string') {
|
||||||
if ('error' in response) {
|
if ('error' in response) {
|
||||||
|
|||||||
Generated
Vendored
+147
-59
@@ -20,30 +20,31 @@ module.exports = class kucoin extends Exchange {
|
|||||||
'comment': 'Platform 2.0',
|
'comment': 'Platform 2.0',
|
||||||
'has': {
|
'has': {
|
||||||
'CORS': false,
|
'CORS': false,
|
||||||
'fetchStatus': true,
|
'cancelAllOrders': true,
|
||||||
'fetchTime': true,
|
'cancelOrder': true,
|
||||||
'fetchMarkets': true,
|
'createDepositAddress': true,
|
||||||
|
'createOrder': true,
|
||||||
|
'fetchAccounts': true,
|
||||||
|
'fetchBalance': true,
|
||||||
|
'fetchClosedOrders': true,
|
||||||
'fetchCurrencies': true,
|
'fetchCurrencies': true,
|
||||||
|
'fetchDepositAddress': true,
|
||||||
|
'fetchDeposits': true,
|
||||||
|
'fetchFundingFee': true,
|
||||||
|
'fetchLedger': true,
|
||||||
|
'fetchMarkets': true,
|
||||||
|
'fetchMyTrades': true,
|
||||||
|
'fetchOHLCV': true,
|
||||||
|
'fetchOpenOrders': true,
|
||||||
|
'fetchOrder': true,
|
||||||
|
'fetchOrderBook': true,
|
||||||
|
'fetchStatus': true,
|
||||||
'fetchTicker': true,
|
'fetchTicker': true,
|
||||||
'fetchTickers': true,
|
'fetchTickers': true,
|
||||||
'fetchOrderBook': true,
|
'fetchTime': true,
|
||||||
'fetchOrder': true,
|
|
||||||
'fetchClosedOrders': true,
|
|
||||||
'fetchOpenOrders': true,
|
|
||||||
'fetchDepositAddress': true,
|
|
||||||
'createDepositAddress': true,
|
|
||||||
'withdraw': true,
|
|
||||||
'fetchDeposits': true,
|
|
||||||
'fetchWithdrawals': true,
|
|
||||||
'fetchBalance': true,
|
|
||||||
'fetchTrades': true,
|
'fetchTrades': true,
|
||||||
'fetchMyTrades': true,
|
'fetchWithdrawals': true,
|
||||||
'createOrder': true,
|
'withdraw': true,
|
||||||
'cancelOrder': true,
|
|
||||||
'fetchAccounts': true,
|
|
||||||
'fetchFundingFee': true,
|
|
||||||
'fetchOHLCV': true,
|
|
||||||
'fetchLedger': true,
|
|
||||||
},
|
},
|
||||||
'urls': {
|
'urls': {
|
||||||
'logo': 'https://user-images.githubusercontent.com/51840849/87295558-132aaf80-c50e-11ea-9801-a2fb0c57c799.jpg',
|
'logo': 'https://user-images.githubusercontent.com/51840849/87295558-132aaf80-c50e-11ea-9801-a2fb0c57c799.jpg',
|
||||||
@@ -74,6 +75,7 @@ module.exports = class kucoin extends Exchange {
|
|||||||
'symbols',
|
'symbols',
|
||||||
'markets',
|
'markets',
|
||||||
'market/allTickers',
|
'market/allTickers',
|
||||||
|
'market/orderbook/level{level}_{limit}',
|
||||||
'market/orderbook/level{level}',
|
'market/orderbook/level{level}',
|
||||||
'market/orderbook/level2',
|
'market/orderbook/level2',
|
||||||
'market/orderbook/level2_20',
|
'market/orderbook/level2_20',
|
||||||
@@ -110,6 +112,7 @@ module.exports = class kucoin extends Exchange {
|
|||||||
'withdrawals',
|
'withdrawals',
|
||||||
'withdrawals/quotas',
|
'withdrawals/quotas',
|
||||||
'orders',
|
'orders',
|
||||||
|
'order/client-order/{clientOid}',
|
||||||
'orders/{orderId}',
|
'orders/{orderId}',
|
||||||
'limit/orders',
|
'limit/orders',
|
||||||
'fills',
|
'fills',
|
||||||
@@ -125,6 +128,9 @@ module.exports = class kucoin extends Exchange {
|
|||||||
'margin/lend/assets',
|
'margin/lend/assets',
|
||||||
'margin/market',
|
'margin/market',
|
||||||
'margin/trade/last',
|
'margin/trade/last',
|
||||||
|
'stop-order/{orderId}',
|
||||||
|
'stop-order',
|
||||||
|
'stop-order/queryOrderByClientOid',
|
||||||
],
|
],
|
||||||
'post': [
|
'post': [
|
||||||
'accounts',
|
'accounts',
|
||||||
@@ -135,17 +141,23 @@ module.exports = class kucoin extends Exchange {
|
|||||||
'orders',
|
'orders',
|
||||||
'orders/multi',
|
'orders/multi',
|
||||||
'margin/borrow',
|
'margin/borrow',
|
||||||
|
'margin/order',
|
||||||
'margin/repay/all',
|
'margin/repay/all',
|
||||||
'margin/repay/single',
|
'margin/repay/single',
|
||||||
'margin/lend',
|
'margin/lend',
|
||||||
'margin/toggle-auto-lend',
|
'margin/toggle-auto-lend',
|
||||||
'bullet-private',
|
'bullet-private',
|
||||||
|
'stop-order',
|
||||||
],
|
],
|
||||||
'delete': [
|
'delete': [
|
||||||
'withdrawals/{withdrawalId}',
|
'withdrawals/{withdrawalId}',
|
||||||
'orders',
|
'orders',
|
||||||
|
'orders/client-order/{clientOid}',
|
||||||
'orders/{orderId}',
|
'orders/{orderId}',
|
||||||
'margin/lend/{orderId}',
|
'margin/lend/{orderId}',
|
||||||
|
'stop-order/cancelOrderByClientOid',
|
||||||
|
'stop-order/{orderId}',
|
||||||
|
'stop-order/cancel',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -236,10 +248,12 @@ module.exports = class kucoin extends Exchange {
|
|||||||
'public': {
|
'public': {
|
||||||
'GET': {
|
'GET': {
|
||||||
'status': 'v1',
|
'status': 'v1',
|
||||||
'market/orderbook/level{level}': 'v1',
|
|
||||||
'market/orderbook/level2': 'v2',
|
'market/orderbook/level2': 'v2',
|
||||||
|
'market/orderbook/level3': 'v2',
|
||||||
'market/orderbook/level2_20': 'v1',
|
'market/orderbook/level2_20': 'v1',
|
||||||
'market/orderbook/level2_100': 'v1',
|
'market/orderbook/level2_100': 'v1',
|
||||||
|
'market/orderbook/level{level}': 'v2',
|
||||||
|
'market/orderbook/level{level}_{limit}': 'v1',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'private': {
|
'private': {
|
||||||
@@ -682,7 +696,10 @@ module.exports = class kucoin extends Exchange {
|
|||||||
address = address.replace ('bitcoincash:', '');
|
address = address.replace ('bitcoincash:', '');
|
||||||
}
|
}
|
||||||
const tag = this.safeString (data, 'memo');
|
const tag = this.safeString (data, 'memo');
|
||||||
this.checkAddress (address);
|
if (code !== 'NIM') {
|
||||||
|
// contains spaces
|
||||||
|
this.checkAddress (address);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
'info': response,
|
'info': response,
|
||||||
'currency': code,
|
'currency': code,
|
||||||
@@ -699,13 +716,12 @@ module.exports = class kucoin extends Exchange {
|
|||||||
// BCH {"code":"200000","data":{"address":"bitcoincash:qza3m4nj9rx7l9r0cdadfqxts6f92shvhvr5ls4q7z","memo":""}}
|
// BCH {"code":"200000","data":{"address":"bitcoincash:qza3m4nj9rx7l9r0cdadfqxts6f92shvhvr5ls4q7z","memo":""}}
|
||||||
// BTC {"code":"200000","data":{"address":"36SjucKqQpQSvsak9A7h6qzFjrVXpRNZhE","memo":""}}
|
// BTC {"code":"200000","data":{"address":"36SjucKqQpQSvsak9A7h6qzFjrVXpRNZhE","memo":""}}
|
||||||
const data = this.safeValue (response, 'data', {});
|
const data = this.safeValue (response, 'data', {});
|
||||||
let address = this.safeString (data, 'address');
|
const address = this.safeString (data, 'address');
|
||||||
// BCH/BSV is returned with a "bitcoincash:" prefix, which we cut off here and only keep the address
|
|
||||||
if (address !== undefined) {
|
|
||||||
address = address.replace ('bitcoincash:', '');
|
|
||||||
}
|
|
||||||
const tag = this.safeString (data, 'memo');
|
const tag = this.safeString (data, 'memo');
|
||||||
this.checkAddress (address);
|
if (code !== 'NIM') {
|
||||||
|
// contains spaces
|
||||||
|
this.checkAddress (address);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
'info': response,
|
'info': response,
|
||||||
'currency': code,
|
'currency': code,
|
||||||
@@ -719,20 +735,22 @@ module.exports = class kucoin extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchOrderBook (symbol, limit = undefined, params = {}) {
|
async fetchOrderBook (symbol, limit = undefined, params = {}) {
|
||||||
const level = this.safeInteger (params, 'level', 2);
|
|
||||||
let levelLimit = level.toString ();
|
|
||||||
if (levelLimit === '2') {
|
|
||||||
if (limit !== undefined) {
|
|
||||||
if ((limit !== 20) && (limit !== 100)) {
|
|
||||||
throw new ExchangeError (this.id + ' fetchOrderBook limit argument must be undefined, 20 or 100');
|
|
||||||
}
|
|
||||||
levelLimit += '_' + limit.toString ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const marketId = this.marketId (symbol);
|
const marketId = this.marketId (symbol);
|
||||||
const request = { 'symbol': marketId, 'level': levelLimit };
|
const level = this.safeInteger (params, 'level', 2);
|
||||||
const response = await this.publicGetMarketOrderbookLevelLevel (this.extend (request, params));
|
const request = { 'symbol': marketId, 'level': level };
|
||||||
|
let method = 'publicGetMarketOrderbookLevelLevel';
|
||||||
|
if (level === 2) {
|
||||||
|
if (limit !== undefined) {
|
||||||
|
if ((limit === 20) || (limit === 100)) {
|
||||||
|
request['limit'] = limit;
|
||||||
|
method = 'publicGetMarketOrderbookLevelLevelLimit';
|
||||||
|
} else {
|
||||||
|
throw new ExchangeError (this.id + ' fetchOrderBook limit argument must be undefined, 20 or 100');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const response = await this[method] (this.extend (request, params));
|
||||||
//
|
//
|
||||||
// 'market/orderbook/level2'
|
// 'market/orderbook/level2'
|
||||||
// 'market/orderbook/level2_20'
|
// 'market/orderbook/level2_20'
|
||||||
@@ -794,7 +812,29 @@ module.exports = class kucoin extends Exchange {
|
|||||||
'clientOid': clientOrderId,
|
'clientOid': clientOrderId,
|
||||||
'side': side,
|
'side': side,
|
||||||
'symbol': marketId,
|
'symbol': marketId,
|
||||||
'type': type,
|
'type': type, // limit or market
|
||||||
|
// 'remark': '', // optional remark for the order, length cannot exceed 100 utf8 characters
|
||||||
|
// 'stp': '', // self trade prevention, CN, CO, CB or DC
|
||||||
|
// To improve the system performance and to accelerate order placing and processing, KuCoin has added a new interface for margin orders
|
||||||
|
// The current one will no longer accept margin orders by May 1st, 2021 (UTC)
|
||||||
|
// At the time, KuCoin will notify users via the announcement, please pay attention to it
|
||||||
|
// 'tradeType': 'TRADE', // TRADE, MARGIN_TRADE // not used with margin orders
|
||||||
|
// limit orders ---------------------------------------------------
|
||||||
|
// 'timeInForce': 'GTC', // GTC, GTT, IOC, or FOK (default is GTC), limit orders only
|
||||||
|
// 'cancelAfter': long, // cancel after n seconds, requires timeInForce to be GTT
|
||||||
|
// 'postOnly': false, // Post only flag, invalid when timeInForce is IOC or FOK
|
||||||
|
// 'hidden': false, // Order will not be displayed in the order book
|
||||||
|
// 'iceberg': false, // Only a portion of the order is displayed in the order book
|
||||||
|
// 'visibleSize': this.amountToPrecision (symbol, visibleSize), // The maximum visible size of an iceberg order
|
||||||
|
// market orders --------------------------------------------------
|
||||||
|
// 'size': this.amountToPrecision (symbol, amount), // Amount in base currency
|
||||||
|
// 'funds': this.costToPrecision (symbol, cost), // Amount of quote currency to use
|
||||||
|
// stop orders ----------------------------------------------------
|
||||||
|
// 'stop': 'loss', // loss or entry, the default is loss, requires stopPrice
|
||||||
|
// 'stopPrice': this.priceToPrecision (symbol, amount), // need to be defined if stop is specified
|
||||||
|
// margin orders --------------------------------------------------
|
||||||
|
// 'marginMode': 'cross', // cross (cross mode) and isolated (isolated mode), set to cross by default, the isolated mode will be released soon, stay tuned
|
||||||
|
// 'autoBorrow': false, // The system will first borrow you funds at the optimal interest rate and then place an order for you
|
||||||
};
|
};
|
||||||
if (type !== 'market') {
|
if (type !== 'market') {
|
||||||
request['price'] = this.priceToPrecision (symbol, price);
|
request['price'] = this.priceToPrecision (symbol, price);
|
||||||
@@ -846,9 +886,32 @@ module.exports = class kucoin extends Exchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async cancelOrder (id, symbol = undefined, params = {}) {
|
async cancelOrder (id, symbol = undefined, params = {}) {
|
||||||
const request = { 'orderId': id };
|
await this.loadMarkets ();
|
||||||
const response = await this.privateDeleteOrdersOrderId (this.extend (request, params));
|
const request = {};
|
||||||
return response;
|
const clientOrderId = this.safeString2 (params, 'clientOid', 'clientOrderId');
|
||||||
|
let method = 'privateDeleteOrdersOrderId';
|
||||||
|
if (clientOrderId !== undefined) {
|
||||||
|
request['clientOid'] = clientOrderId;
|
||||||
|
method = 'privateDeleteOrdersClientOrderClientOid';
|
||||||
|
} else {
|
||||||
|
request['orderId'] = id;
|
||||||
|
}
|
||||||
|
params = this.omit (params, [ 'clientOid', 'clientOrderId' ]);
|
||||||
|
return await this[method] (this.extend (request, params));
|
||||||
|
}
|
||||||
|
|
||||||
|
async cancelAllOrders (symbol = undefined, params = {}) {
|
||||||
|
await this.loadMarkets ();
|
||||||
|
const request = {
|
||||||
|
// 'symbol': market['id'],
|
||||||
|
// 'tradeType': 'TRADE', // default is to cancel the spot trading order
|
||||||
|
};
|
||||||
|
let market = undefined;
|
||||||
|
if (symbol !== undefined) {
|
||||||
|
market = this.market (symbol);
|
||||||
|
request['symbol'] = market['id'];
|
||||||
|
}
|
||||||
|
return await this.privateDeleteOrders (this.extend (request, params));
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchOrdersByStatus (status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOrdersByStatus (status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
@@ -926,20 +989,27 @@ module.exports = class kucoin extends Exchange {
|
|||||||
|
|
||||||
async fetchOrder (id, symbol = undefined, params = {}) {
|
async fetchOrder (id, symbol = undefined, params = {}) {
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
// a special case for undefined ids
|
const request = {};
|
||||||
// otherwise a wrong endpoint for all orders will be triggered
|
const clientOrderId = this.safeString2 (params, 'clientOid', 'clientOrderId');
|
||||||
// https://github.com/ccxt/ccxt/issues/7234
|
let method = 'privateGetOrdersOrderId';
|
||||||
if (id === undefined) {
|
if (clientOrderId !== undefined) {
|
||||||
throw new InvalidOrder (this.id + ' fetchOrder requires an order id');
|
request['clientOid'] = clientOrderId;
|
||||||
|
method = 'privateGetOrdersClientOrderClientOid';
|
||||||
|
} else {
|
||||||
|
// a special case for undefined ids
|
||||||
|
// otherwise a wrong endpoint for all orders will be triggered
|
||||||
|
// https://github.com/ccxt/ccxt/issues/7234
|
||||||
|
if (id === undefined) {
|
||||||
|
throw new InvalidOrder (this.id + ' fetchOrder() requires an order id');
|
||||||
|
}
|
||||||
|
request['orderId'] = id;
|
||||||
}
|
}
|
||||||
const request = {
|
params = this.omit (params, [ 'clientOid', 'clientOrderId' ]);
|
||||||
'orderId': id,
|
const response = await this[method] (this.extend (request, params));
|
||||||
};
|
|
||||||
let market = undefined;
|
let market = undefined;
|
||||||
if (symbol !== undefined) {
|
if (symbol !== undefined) {
|
||||||
market = this.market (symbol);
|
market = this.market (symbol);
|
||||||
}
|
}
|
||||||
const response = await this.privateGetOrdersOrderId (this.extend (request, params));
|
|
||||||
const responseData = this.safeValue (response, 'data');
|
const responseData = this.safeValue (response, 'data');
|
||||||
return this.parseOrder (responseData, market);
|
return this.parseOrder (responseData, market);
|
||||||
}
|
}
|
||||||
@@ -1016,12 +1086,14 @@ module.exports = class kucoin extends Exchange {
|
|||||||
const clientOrderId = this.safeString (order, 'clientOid');
|
const clientOrderId = this.safeString (order, 'clientOid');
|
||||||
const timeInForce = this.safeString (order, 'timeInForce');
|
const timeInForce = this.safeString (order, 'timeInForce');
|
||||||
const stopPrice = this.safeFloat (order, 'stopPrice');
|
const stopPrice = this.safeFloat (order, 'stopPrice');
|
||||||
|
const postOnly = this.safeValue (order, 'postOnly');
|
||||||
return {
|
return {
|
||||||
'id': orderId,
|
'id': orderId,
|
||||||
'clientOrderId': clientOrderId,
|
'clientOrderId': clientOrderId,
|
||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': timeInForce,
|
'timeInForce': timeInForce,
|
||||||
|
'postOnly': postOnly,
|
||||||
'side': side,
|
'side': side,
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
'price': price,
|
'price': price,
|
||||||
@@ -1350,6 +1422,7 @@ module.exports = class kucoin extends Exchange {
|
|||||||
// "status": "SUCCESS",
|
// "status": "SUCCESS",
|
||||||
// "createdAt": 1544178843000,
|
// "createdAt": 1544178843000,
|
||||||
// "updatedAt": 1544178891000
|
// "updatedAt": 1544178891000
|
||||||
|
// "remark":"foobar"
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// fetchWithdrawals
|
// fetchWithdrawals
|
||||||
@@ -1366,6 +1439,7 @@ module.exports = class kucoin extends Exchange {
|
|||||||
// "status": "FAILURE",
|
// "status": "FAILURE",
|
||||||
// "createdAt": 1546503758000,
|
// "createdAt": 1546503758000,
|
||||||
// "updatedAt": 1546504603000
|
// "updatedAt": 1546504603000
|
||||||
|
// "remark":"foobar"
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
const currencyId = this.safeString (transaction, 'currency');
|
const currencyId = this.safeString (transaction, 'currency');
|
||||||
@@ -1416,20 +1490,26 @@ module.exports = class kucoin extends Exchange {
|
|||||||
updated = updated * 1000;
|
updated = updated * 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const comment = this.safeString (transaction, 'remark');
|
||||||
return {
|
return {
|
||||||
'id': id,
|
'id': id,
|
||||||
|
'info': transaction,
|
||||||
|
'timestamp': timestamp,
|
||||||
|
'datetime': this.iso8601 (timestamp),
|
||||||
'address': address,
|
'address': address,
|
||||||
|
'addressTo': address,
|
||||||
|
'addressFrom': undefined,
|
||||||
'tag': tag,
|
'tag': tag,
|
||||||
|
'tagTo': tag,
|
||||||
|
'tagFrom': undefined,
|
||||||
'currency': code,
|
'currency': code,
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
'txid': txid,
|
'txid': txid,
|
||||||
'type': type,
|
'type': type,
|
||||||
'status': status,
|
'status': status,
|
||||||
|
'comment': comment,
|
||||||
'fee': fee,
|
'fee': fee,
|
||||||
'timestamp': timestamp,
|
|
||||||
'datetime': this.iso8601 (timestamp),
|
|
||||||
'updated': updated,
|
'updated': updated,
|
||||||
'info': transaction,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1477,6 +1557,7 @@ module.exports = class kucoin extends Exchange {
|
|||||||
// "status": "SUCCESS",
|
// "status": "SUCCESS",
|
||||||
// "createdAt": 1544178843000,
|
// "createdAt": 1544178843000,
|
||||||
// "updatedAt": 1544178891000
|
// "updatedAt": 1544178891000
|
||||||
|
// "remark":"foobar"
|
||||||
// },
|
// },
|
||||||
// //--------------------------------------------------
|
// //--------------------------------------------------
|
||||||
// // version 1 (historical) deposit response structure
|
// // version 1 (historical) deposit response structure
|
||||||
@@ -1606,7 +1687,7 @@ module.exports = class kucoin extends Exchange {
|
|||||||
|
|
||||||
async fetchLedger (code = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchLedger (code = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (code === undefined) {
|
if (code === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchLedger requires a code param');
|
throw new ArgumentsRequired (this.id + ' fetchLedger() requires a code param');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
await this.loadAccounts ();
|
await this.loadAccounts ();
|
||||||
@@ -1749,7 +1830,7 @@ module.exports = class kucoin extends Exchange {
|
|||||||
// † ↑
|
// † ↑
|
||||||
//
|
//
|
||||||
const versions = this.safeValue (this.options, 'versions', {});
|
const versions = this.safeValue (this.options, 'versions', {});
|
||||||
const apiVersions = this.safeValue (versions, api);
|
const apiVersions = this.safeValue (versions, api, {});
|
||||||
const methodVersions = this.safeValue (apiVersions, method, {});
|
const methodVersions = this.safeValue (apiVersions, method, {});
|
||||||
const defaultVersion = this.safeString (methodVersions, path, this.options['version']);
|
const defaultVersion = this.safeString (methodVersions, path, this.options['version']);
|
||||||
const version = this.safeString (params, 'version', defaultVersion);
|
const version = this.safeString (params, 'version', defaultVersion);
|
||||||
@@ -1772,10 +1853,17 @@ module.exports = class kucoin extends Exchange {
|
|||||||
this.checkRequiredCredentials ();
|
this.checkRequiredCredentials ();
|
||||||
const timestamp = this.nonce ().toString ();
|
const timestamp = this.nonce ().toString ();
|
||||||
headers = this.extend ({
|
headers = this.extend ({
|
||||||
|
'KC-API-KEY-VERSION': '2',
|
||||||
'KC-API-KEY': this.apiKey,
|
'KC-API-KEY': this.apiKey,
|
||||||
'KC-API-TIMESTAMP': timestamp,
|
'KC-API-TIMESTAMP': timestamp,
|
||||||
'KC-API-PASSPHRASE': this.password,
|
|
||||||
}, headers);
|
}, headers);
|
||||||
|
const apiKeyVersion = this.safeString (headers, 'KC-API-KEY-VERSION');
|
||||||
|
if (apiKeyVersion === '2') {
|
||||||
|
const passphrase = this.hmac (this.encode (this.password), this.encode (this.secret), 'sha256', 'base64');
|
||||||
|
headers['KC-API-PASSPHRASE'] = passphrase;
|
||||||
|
} else {
|
||||||
|
headers['KC-API-PASSPHRASE'] = this.password;
|
||||||
|
}
|
||||||
const payload = timestamp + method + endpoint + endpart;
|
const payload = timestamp + method + endpoint + endpart;
|
||||||
const signature = this.hmac (this.encode (payload), this.encode (this.secret), 'sha256', 'base64');
|
const signature = this.hmac (this.encode (payload), this.encode (this.secret), 'sha256', 'base64');
|
||||||
headers['KC-API-SIGN'] = signature;
|
headers['KC-API-SIGN'] = signature;
|
||||||
|
|||||||
Generated
Vendored
+2
-2
@@ -120,7 +120,7 @@ module.exports = class kuna extends acx {
|
|||||||
|
|
||||||
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOpenOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOpenOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -182,7 +182,7 @@ module.exports = class kuna extends acx {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOpenOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
|
|||||||
Generated
Vendored
+4
-3
@@ -534,7 +534,7 @@ module.exports = class latoken extends Exchange {
|
|||||||
|
|
||||||
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchMyTrades requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchMyTrades() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -646,6 +646,7 @@ module.exports = class latoken extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
@@ -680,7 +681,7 @@ module.exports = class latoken extends Exchange {
|
|||||||
|
|
||||||
async fetchOrdersWithMethod (method, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
async fetchOrdersWithMethod (method, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOrdersWithMethod requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' fetchOrdersWithMethod() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
@@ -796,7 +797,7 @@ module.exports = class latoken extends Exchange {
|
|||||||
|
|
||||||
async cancelAllOrders (symbol = undefined, params = {}) {
|
async cancelAllOrders (symbol = undefined, params = {}) {
|
||||||
if (symbol === undefined) {
|
if (symbol === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' cancelAllOrders requires a symbol argument');
|
throw new ArgumentsRequired (this.id + ' cancelAllOrders() requires a symbol argument');
|
||||||
}
|
}
|
||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const marketId = this.marketId (symbol);
|
const marketId = this.marketId (symbol);
|
||||||
|
|||||||
Generated
Vendored
+3
-2
@@ -358,10 +358,10 @@ module.exports = class lbank extends Exchange {
|
|||||||
await this.loadMarkets ();
|
await this.loadMarkets ();
|
||||||
const market = this.market (symbol);
|
const market = this.market (symbol);
|
||||||
if (since === undefined) {
|
if (since === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOHLCV requires a `since` argument');
|
throw new ArgumentsRequired (this.id + ' fetchOHLCV() requires a `since` argument');
|
||||||
}
|
}
|
||||||
if (limit === undefined) {
|
if (limit === undefined) {
|
||||||
throw new ArgumentsRequired (this.id + ' fetchOHLCV requires a `limit` argument');
|
throw new ArgumentsRequired (this.id + ' fetchOHLCV() requires a `limit` argument');
|
||||||
}
|
}
|
||||||
const request = {
|
const request = {
|
||||||
'symbol': market['id'],
|
'symbol': market['id'],
|
||||||
@@ -486,6 +486,7 @@ module.exports = class lbank extends Exchange {
|
|||||||
'symbol': symbol,
|
'symbol': symbol,
|
||||||
'type': type,
|
'type': type,
|
||||||
'timeInForce': undefined,
|
'timeInForce': undefined,
|
||||||
|
'postOnly': undefined,
|
||||||
'side': side,
|
'side': side,
|
||||||
'price': price,
|
'price': price,
|
||||||
'stopPrice': undefined,
|
'stopPrice': undefined,
|
||||||
|
|||||||
Loaded 100 of 261 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user