Hello, is there any way to get the combo bot closed deals from the api??
Yes, but it isn’t official and therefore maybe not yet available for us users.
You have to send a POST
request to https://api.gainium.io/
with a content like
{
"query": "query($input: getBotDealsInput!) { \n getBotDeals(input: $input) {\n status\n reason\n data {\n deals {\n \nnote\n _id\n botId\n userId\n status\n initialBalances {\n base\n quote\n }\n currentBalances {\n base\n quote\n }\n initialPrice\n lastPrice\n profit {\n total\n totalUsd\n pureBase\n pureQuote\n }\n feePaid {\n base\n quote\n }\n avgPrice\n displayAvg\n commission\n createTime\n updateTime\n closeTime\n levels {\n all\n complete\n }\n usage {\n current {\n base\n quote\n }\n max {\n base\n quote\n }\n }\n settings {\n dcaCondition\nbaseSlOn\n closeByTimer\n closeByTimerValue\n closeByTimerUnits\n dcaCustom {\n uuid\n step\n size\n }\n ordersCount\n tpPerc\n slPerc\n profitCurrency\n avgPrice\n baseOrderSize\n baseOrderPrice\n useLimitPrice\n startOrderType\n orderSize\n useTp\n useSl\n useDca\n useSmartOrders\n activeOrdersCount\n trailingSl\n moveSL\n moveSLTrigger\n moveSLValue\n moveSLForAll\n dealCloseCondition\n trailingTp\n trailingTpPerc\n useMinTP\n minTp\n closeDealType\n orderSizeType\n useMultiSl\n multiSl {\n target\n amount\n uuid\n }\n useMultiTp\n multiTp {\n target\n amount\n uuid\n }\n volumeScale\n stepScale\n avgPrice\n changed\n orderSizePercQty\n step\n dealCloseConditionSL\n futures\n coinm\n marginType\n leverage\n useFixedTPPrices\n useFixedSLPrices\nfixedTpPrice\nfixedSlPrice\n feeOrder\n }\n assets {\n used {\n base\n quote\n }\n required {\n base\n quote\n }\n }\n dcaBot {\n settings {\n \ndcaCondition\nbaseSlOn\ncloseByTimer\n closeByTimerValue\n closeByTimerUnits\n maxDealsPerHigherTimeframe\n useMaxDealsPerHigherTimeframe\n remainderFullAmount\n useStaticPriceFilter\n useCooldown\n useVolumeFilterAll\n useDynamicPriceFilter\n dynamicPriceFilterDeviation\n dynamicPriceFilterPriceType\ndynamicPriceFilterDirection\nuseRiskReward\n riskSlType\n riskSlAmountPerc\n riskSlAmountValue\n riskUseTpRatio\n riskTpRatio\n riskMinPositionSize\nscaleDcaType\n startDealLogic\n stopDealLogic\n stopDealSlLogic\n stopBotLogic\nuseRiskReduction\n riskReductionValue\n useReinvest\n reinvestValue\n riskMaxPositionSize\ndynamicArLockValue\nriskMaxSl\n riskMinSl\ndcaCustom {\n uuid\n step\n size\n}\npair\n name\n strategy\n profitCurrency\n baseOrderSize\n baseOrderPrice\n useLimitPrice\n startOrderType\n startCondition\n tpPerc\n orderFixedIn\n orderSize\n step\n ordersCount\n activeOrdersCount\n volumeScale\n stepScale\n useTp\n useSmartOrders\n minOpenDeal\n maxOpenDeal\n useDca\n hodlAt\n hodlHourly\n hodlDay\n hodlNextBuy\n maxNumberOfOpenDeals\n useSl\n slPerc\n orderSizeType\n indicators {\n type\n uuid\n indicatorLength\n indicatorValue\n indicatorCondition\n indicatorInterval\n signal\n checkLevel\n condition\n maType\n maCrossingValue\n maCrossingInterval\n maCrossingLength\n maUUID\n bbCrossingValue\n stochSmoothK\n stochSmoothD\n stochUpper\n stochLower\n stochRSI\n srCrossingValue\n leftBars\n rightBars\n basePeriods\n pumpPeriods\n pump\n baseCrack\n rsiValue\n rsiValue2\n stochRange\n valueInsteadof\n indicatorAction\n section\n psarInc\n psarMax\n psarStart\n minPercFromLast\n keepConditionBars\n orderSize\n voLong\n voShort\n uoFast\n uoMiddle\n uoSlow\n momSource\n bbwpLookback\n ecdTrigger\n xOscillator1\n xOscillator2\n xOscillator2length\n xOscillator2Interval\n xoUUID\n percentile\n percentileLookback\n percentilePercentage\n mar1type\n mar1length\n mar2type\n mar2length\n bbwMa\n bbwMaLength\n bbwMult\n macdFast\n macdSlow\n macdMaSource\n macdMaSignal\n divOscillators\n divType\n divMinCount\n trendFilter\n trendFilterLookback\n trendFilterType\n trendFilterValue\n factor\n atrLength\n pcUp\n pcDown\n pcCondition\n pcValue\n ppHighLeft\n ppHighRight\n ppLowLeft\n ppLowRight\n ppMult\n ppValue\n ppType\nriskAtrMult\ndynamicArFactor\nathLookback\nkcMa\nkcRange\nkcRangeLength\n stCondition\n }\n limitTimeout \n useLimitTimeout\n notUseLimitReposition\n cooldownAfterDealStart\n cooldownAfterDealStartUnits\n cooldownAfterDealStartInterval\n cooldownAfterDealStop\n cooldownAfterDealStopUnits\n cooldownAfterDealStopInterval\n cooldownAfterDealStartOption\n cooldownAfterDealStopOption\n moveSL\n moveSLTrigger\n moveSLValue\n moveSLForAll\n trailingSl\n trailingTp\n trailingTpPerc\n useCloseAfterX\n closeAfterX\n useMulti\n maxDealsPerPair\n ignoreStartDeals\n comboTpBase\ncomboSmartGridsCount\n comboUseSmartGrids\n useBotController\n useCloseAfterXopen\n closeAfterXopen\n botStart\n stopType\n dealCloseCondition\n dealCloseConditionSL\n useMinTP\n minTp\n closeDealType\n terminalDealType\n useMultiTp\n multiTp {\n target\n amount\n uuid\n }\n useMultiSl\n pairPrioritization\n multiSl {\n target\n amount\n uuid\n }\n marginType\n leverage\n futures\n coinm\n useVolumeFilter\n volumeTop\n volumeValue\n useFixedTPPrices\n useFixedSLPrices\nfixedTpPrice\nfixedSlPrice\n baseStep\n baseGridLevels\n useActiveMinigrids\n comboActiveMinigrids\n comboSlLimit\n comboTpLimit\n useRelativeVolumeFilter\n relativeVolumeTop\n relativeVolumeValue\n feeOrder\n\n }\n symbol {\n symbol\n baseAsset\n quoteAsset\n }\n }\n gridBreakpoints{\n price\n displacedPrice\n }\n strategy\n exchange\n exchangeUUID\n symbol {\n baseAsset\n quoteAsset\n symbol\n }\n trailingLevel\n trailingMode\n bestPrice\n stats {\n drawdownPercent\n runUpPercent\n timeInProfit\n timeInLoss\n trackTime\n timeCountStart\n currentCount\n }\n tpSlTargetFilled\n dynamicAr {\n value\n id\n }\n funds {\n price\n qty\n }\n pendingAddFunds {\n qty\n useLimitPrice\n limitPrice\n asset\n id\n }\n blockOrders {\n price\n qty\n side\n }\n moveSlActivated\n parent\n cost\n size\n sizes {\n base\n dca\n origBase\n origDca\n }\n \n }\n page\n total\n stats {\n avgUsage\n avgProfit\n avgTradingTime\n avgTimeInLoss\n avgTimeInProfit\n winRate\n }\n }\n }\n }",
"variables": {
"input": {
"id": "<your bot id>",
"page": 0,
"status": "closed"
}
}
}
The response will be something like that
{
"data": {
"getBotDeals": {
"status": "string",
"reason": null,
"data": {
"deals": [
{
"note": null,
"_id": "string",
"botId": "string",
"userId": "string",
"status": "string",
"initialBalances": {
"base": 0,
"quote": 0
},
"currentBalances": {
"base": 0,
"quote": 0
},
"initialPrice": 0,
"lastPrice": 0,
"profit": {
"total": 0,
"totalUsd": 0,
"pureBase": 0,
"pureQuote": 0
},
"feePaid": {
"base": 0,
"quote": 0
},
"avgPrice": 0,
"displayAvg": 0,
"commission": 0,
"createTime": 0,
"updateTime": 0,
"closeTime": 0,
"levels": {
"all": 0,
"complete": 0
},
"usage": {
"current": {
"base": 0,
"quote": 0
},
"max": {
"base": 0,
"quote": 0
}
},
"settings": {
"dcaCondition": "string",
"baseSlOn": null,
"closeByTimer": null,
"closeByTimerValue": null,
"closeByTimerUnits": null,
"dcaCustom": [],
"ordersCount": 0,
"tpPerc": "string",
"slPerc": "string",
"profitCurrency": "string",
"avgPrice": 0,
"baseOrderSize": "string",
"baseOrderPrice": null,
"useLimitPrice": null,
"startOrderType": "string",
"orderSize": "string",
"useTp": true,
"useSl": true,
"useDca": true,
"useSmartOrders": true,
"activeOrdersCount": 0,
"trailingSl": true,
"moveSL": true,
"moveSLTrigger": "string",
"moveSLValue": "string",
"moveSLForAll": null,
"dealCloseCondition": "string",
"trailingTp": true,
"trailingTpPerc": "string",
"useMinTP": true,
"minTp": "string",
"closeDealType": null,
"orderSizeType": "string",
"useMultiSl": true,
"multiSl": [],
"useMultiTp": true,
"multiTp": [],
"volumeScale": "string",
"stepScale": "string",
"changed": true,
"orderSizePercQty": 0,
"step": "string",
"dealCloseConditionSL": "string",
"futures": true,
"coinm": true,
"marginType": "string",
"leverage": 0,
"useFixedTPPrices": null,
"useFixedSLPrices": null,
"fixedTpPrice": null,
"fixedSlPrice": null,
"feeOrder": null
},
"assets": {
"used": {
"base": 0,
"quote": 0
},
"required": {
"base": 0,
"quote": 0
}
},
"dcaBot": null,
"gridBreakpoints": [],
"strategy": "string",
"exchange": "string",
"exchangeUUID": "string",
"symbol": {
"baseAsset": "string",
"quoteAsset": "string",
"symbol": "string"
},
"trailingLevel": null,
"trailingMode": null,
"bestPrice": null,
"stats": {
"drawdownPercent": 0,
"runUpPercent": 0,
"timeInProfit": 0,
"timeInLoss": 0,
"trackTime": 0,
"timeCountStart": "string",
"currentCount": null
},
"tpSlTargetFilled": [],
"dynamicAr": [],
"funds": [],
"pendingAddFunds": [],
"blockOrders": [],
"moveSlActivated": null,
"parent": true,
"cost": 0,
"size": 0,
"sizes": {}
}
],
"page": 0,
"total": 0,
"stats": {
"avgUsage": 0,
"avgProfit": 0,
"avgTradingTime": 0,
"avgTimeInLoss": 0,
"avgTimeInProfit": 0,
"winRate": 0
}
}
},
"getDealOrders": {
"status": "string",
"reason": null,
"data": [
{
"clientOrderId": "string",
"origQty": "string",
"executedQty": "string",
"price": "string",
"side": "string",
"status": "string",
"time": null,
"transactTime": 0,
"type": "string",
"updateTime": 0,
"botId": "string",
"userId": "string",
"typeOrder": "string",
"baseAsset": "string",
"quoteAsset": "string",
"dealId": "string",
"tpSlTarget": null,
"sl": null
}
]
}
}
}
To find out about endpoints you can always use the browser’s developer tools, check the tabulator Network or use an OpenAPI extension to record executed requests and received responses on the fly.
Thanks, i’ve tried what you said but i get the following error: { errors: [ { message: ‘Session is expired, please login again’ } ] }
I don’t understand why, because i’m following the docs from the api:
const currentDate = new Date().getTime();
const apiUrl = `https://api.gainium.io`;
const body = JSON.stringify({
query: `"query($input: getBotDealsInput!) { \n getComboBotDeals(input: $input) {\n status\n reason\n data {\n deals {\n \nnote\nmoveSlActivated\n _id\n botId\n userId\n status\n initialBalances {\n base\n quote\n }\n currentBalances {\n base\n quote\n }\n initialPrice\n lastPrice\n profit {\n total\n totalUsd\n pureBase\n pureQuote\n gridProfit\n gridProfitUsd\n }\n feePaid {\n base\n quote\n }\n avgPrice\n displayAvg\n commission\n createTime\n updateTime\n closeTime\n levels {\n all\n complete\n }\n usage {\n current {\n base\n quote\n }\n max {\n base\n quote\n }\n }\n settings {\n dcaCondition\nbaseSlOn\n closeByTimer\n closeByTimerValue\n closeByTimerUnits\n dcaCustom {\n uuid\n step\n size\n }\n ordersCount\n tpPerc\n slPerc\n profitCurrency\n avgPrice\n baseOrderSize\n baseOrderPrice\n useLimitPrice\n startOrderType\n orderSize\n useTp\n useSl\n useDca\n useSmartOrders\n activeOrdersCount\n trailingSl\n moveSL\n moveSLTrigger\n moveSLValue\n moveSLForAll\n dealCloseCondition\n trailingTp\n trailingTpPerc\n useMinTP\n minTp\n closeDealType\n orderSizeType\n useMultiSl\n multiSl {\n target\n amount\n uuid\n }\n useMultiTp\n multiTp {\n target\n amount\n uuid\n }\n volumeScale\n stepScale\n avgPrice\n changed\n orderSizePercQty\n step\n dealCloseConditionSL\n futures\n coinm\n marginType\n leverage\n gridLevel\n feeOrder\n useFixedTPPrices\n useFixedSLPrices\nfixedTpPrice\nfixedSlPrice\n updatedComboAdjustments\n comboTpBase\ncomboSmartGridsCount\n comboUseSmartGrids\n }\n assets {\n used {\n base\n quote\n }\n required {\n base\n quote\n }\n }\n dcaBot {\n settings {\n \ndcaCondition\nbaseSlOn\ncloseByTimer\n closeByTimerValue\n closeByTimerUnits\n maxDealsPerHigherTimeframe\n useMaxDealsPerHigherTimeframe\n remainderFullAmount\n useStaticPriceFilter\n useCooldown\n useVolumeFilterAll\n useDynamicPriceFilter\n dynamicPriceFilterDeviation\n dynamicPriceFilterPriceType\ndynamicPriceFilterDirection\nuseRiskReward\n riskSlType\n riskSlAmountPerc\n riskSlAmountValue\n riskUseTpRatio\n riskTpRatio\n riskMinPositionSize\nscaleDcaType\n startDealLogic\n stopDealLogic\n stopDealSlLogic\n stopBotLogic\nuseRiskReduction\n riskReductionValue\n useReinvest\n reinvestValue\n riskMaxPositionSize\ndynamicArLockValue\nriskMaxSl\n riskMinSl\ndcaCustom {\n uuid\n step\n size\n}\npair\n name\n strategy\n profitCurrency\n baseOrderSize\n baseOrderPrice\n useLimitPrice\n startOrderType\n startCondition\n tpPerc\n orderFixedIn\n orderSize\n step\n ordersCount\n activeOrdersCount\n volumeScale\n stepScale\n useTp\n useSmartOrders\n minOpenDeal\n maxOpenDeal\n useDca\n hodlAt\n hodlHourly\n hodlDay\n hodlNextBuy\n maxNumberOfOpenDeals\n useSl\n slPerc\n orderSizeType\n indicators {\n type\n uuid\n indicatorLength\n indicatorValue\n indicatorCondition\n indicatorInterval\n signal\n checkLevel\n condition\n maType\n maCrossingValue\n maCrossingInterval\n maCrossingLength\n maUUID\n bbCrossingValue\n stochSmoothK\n stochSmoothD\n stochUpper\n stochLower\n stochRSI\n srCrossingValue\n leftBars\n rightBars\n basePeriods\n pumpPeriods\n pump\n baseCrack\n rsiValue\n rsiValue2\n stochRange\n valueInsteadof\n indicatorAction\n section\n psarInc\n psarMax\n psarStart\n minPercFromLast\n keepConditionBars\n orderSize\n voLong\n voShort\n uoFast\n uoMiddle\n uoSlow\n momSource\n bbwpLookback\n ecdTrigger\n xOscillator1\n xOscillator2\n xOscillator2length\n xOscillator2Interval\n xoUUID\n percentile\n percentileLookback\n percentilePercentage\n mar1type\n mar1length\n mar2type\n mar2length\n bbwMa\n bbwMaLength\n bbwMult\n macdFast\n macdSlow\n macdMaSource\n macdMaSignal\n divOscillators\n divType\n divMinCount\n trendFilter\n trendFilterLookback\n trendFilterType\n trendFilterValue\n factor\n atrLength\n pcUp\n pcDown\n pcCondition\n pcValue\n ppHighLeft\n ppHighRight\n ppLowLeft\n ppLowRight\n ppMult\n ppValue\n ppType\nriskAtrMult\ndynamicArFactor\nathLookback\nkcMa\nkcRange\nkcRangeLength\n stCondition\n }\n limitTimeout \n useLimitTimeout\n notUseLimitReposition\n cooldownAfterDealStart\n cooldownAfterDealStartUnits\n cooldownAfterDealStartInterval\n cooldownAfterDealStop\n cooldownAfterDealStopUnits\n cooldownAfterDealStopInterval\n cooldownAfterDealStartOption\n cooldownAfterDealStopOption\n moveSL\n moveSLTrigger\n moveSLValue\n moveSLForAll\n trailingSl\n trailingTp\n trailingTpPerc\n useCloseAfterX\n closeAfterX\n useMulti\n maxDealsPerPair\n ignoreStartDeals\n comboTpBase\ncomboSmartGridsCount\n comboUseSmartGrids\n useBotController\n useCloseAfterXopen\n closeAfterXopen\n botStart\n stopType\n dealCloseCondition\n dealCloseConditionSL\n useMinTP\n minTp\n closeDealType\n terminalDealType\n useMultiTp\n multiTp {\n target\n amount\n uuid\n }\n useMultiSl\n pairPrioritization\n multiSl {\n target\n amount\n uuid\n }\n marginType\n leverage\n futures\n coinm\n useVolumeFilter\n volumeTop\n volumeValue\n useFixedTPPrices\n useFixedSLPrices\nfixedTpPrice\nfixedSlPrice\n baseStep\n baseGridLevels\n useActiveMinigrids\n comboActiveMinigrids\n comboSlLimit\n comboTpLimit\n useRelativeVolumeFilter\n relativeVolumeTop\n relativeVolumeValue\n feeOrder\n\n }\n symbol {\n symbol\n baseAsset\n quoteAsset\n }\n }\n gridBreakpoints{\n price\n displacedPrice\n }\n strategy\n exchange\n exchangeUUID\n symbol {\n baseAsset\n quoteAsset\n symbol\n }\n trailingLevel\n trailingMode\n bestPrice\n stats {\n drawdownPercent\n runUpPercent\n timeInProfit\n timeInLoss\n trackTime\n timeCountStart\n currentCount\n }\n tpSlTargetFilled\n dynamicAr {\n value\n id\n }\n cost\n size\n feeBalance\n transactions {\n buy\n sell\n }\n sizes {\n base\n dca\n origBase\n origDca\n }\n \n }\n page\n total\n stats {\n avgUsage\n avgProfit\n avgTradingTime\n avgTimeInLoss\n avgTimeInProfit\n winRate\n }\n }\n }\n }"`,
variables: {
input: {
id: 'XXXXXXXXXX',
page: 0,
status: 'closed',
},
},
});
const querystring = `${body}POST/${currentDate}`;
let response = undefined;
try {
response = await axios.post(`${apiUrl}/`, body, {
headers: {
token: apiKey,
time: currentDate,
signature: this.generateSignature(querystring, apiSecret),
},
});
console.log(response.status, response.headers, response.data);
} catch (err) {
console.log(err);
// console.log(err.response.data);
}
Is there something wrong with the documentation authentication for this type of requests??
I guess that is a question for @maksym.shamko. I wonder whether you need the /
for the root endpoint in the querystring
. I also cannot tell you whether you require certain cookies in place as this originally is a request that is send from the homepage and maybe isn’t meant to be used directly.
I added a botType param to deals endpoint. You can get combo deals there.
What you trying to request to is our internal API. I cant give you any information about how to use it. You should use public API. If something is missing you can always suggest to add it.
Thanks that botType parameter did i what i needed.
Is it possible to filter by closed date?? I don’t want to make excess requests just to have the deals closed for the day.
Thanks for the reply. Amazing response time from this comunity.
Currently not supported. You can create a feature request. Maybe you want some more filter except date.
Are those GraphQL queries? Would the request run if we logged into our account and used the current cookies and the session token in the header of the request?