cleaning competition concept
This commit is contained in:
1 parent
5369764429
commit
6ee36b0687
3 files changed
+1
-100
No files matched your search
@@ -68,11 +68,6 @@
|
||||
break;
|
||||
}
|
||||
|
||||
case 'Competition': {
|
||||
getMarketRateFromExchange();
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
logger.write(MODULE_NAME, "[ERROR] initialize -> Unexpected bot.startMode.");
|
||||
logger.write(MODULE_NAME, "[ERROR] initialize -> bot.startMode = " + bot.startMode);
|
||||
@@ -357,13 +352,6 @@
|
||||
break;
|
||||
}
|
||||
|
||||
case "Competition": {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] getPositionsAtExchange -> Competition Mode Detected."); }
|
||||
exchangeAPI.getOpenPositions(bot.market, onResponse);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
logger.write(MODULE_NAME, "[ERROR] getPositionsAtExchange -> Unexpected bot.startMode.");
|
||||
logger.write(MODULE_NAME, "[ERROR] getPositionsAtExchange -> bot.startMode = " + bot.startMode);
|
||||
@@ -587,13 +575,6 @@
|
||||
return;
|
||||
}
|
||||
|
||||
case "Competition": {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] ordersExecutionCheck -> loopBody -> getPositionTradesAtExchange -> Competition Mode Detected."); }
|
||||
exchangeAPI.getExecutedTrades(pPositionId, onResponse);
|
||||
return;
|
||||
}
|
||||
|
||||
default: {
|
||||
logger.write(MODULE_NAME, "[ERROR] ordersExecutionCheck -> loopBody -> getPositionTradesAtExchange -> Unexpected bot.startMode.");
|
||||
logger.write(MODULE_NAME, "[ERROR] ordersExecutionCheck -> loopBody -> getPositionTradesAtExchange -> bot.startMode = " + bot.startMode);
|
||||
@@ -995,12 +976,6 @@
|
||||
return;
|
||||
}
|
||||
|
||||
case "Competition": {
|
||||
|
||||
exchangeAPI.putPosition(bot.market, pType, pRate, pAmountA, pAmountB, onResponse);
|
||||
return;
|
||||
}
|
||||
|
||||
default: {
|
||||
logger.write(MODULE_NAME, "[ERROR] putPosition -> Unexpected bot.startMode.");
|
||||
logger.write(MODULE_NAME, "[ERROR] putPosition -> bot.startMode = " + bot.startMode);
|
||||
@@ -1121,12 +1096,6 @@
|
||||
return;
|
||||
}
|
||||
|
||||
case "Competition": {
|
||||
|
||||
exchangeAPI.movePosition(pPosition, pNewRate, newAmountB, onResponse);
|
||||
return;
|
||||
}
|
||||
|
||||
default: {
|
||||
logger.write(MODULE_NAME, "[ERROR] movePosition -> Unexpected bot.startMode.");
|
||||
logger.write(MODULE_NAME, "[ERROR] movePosition -> bot.startMode = " + bot.startMode);
|
||||
|
||||
+1
-65
@@ -11,59 +11,18 @@
|
||||
getExecutedTrades: getExecutedTrades,
|
||||
putPosition: putPosition,
|
||||
movePosition: movePosition,
|
||||
getPublicTradeHistory: getPublicTradeHistory,
|
||||
getExchangeProperties: getExchangeProperties,
|
||||
getMaxDecimalPositions: getMaxDecimalPositions
|
||||
};
|
||||
|
||||
return thisObject;
|
||||
|
||||
function initialize(callBackFunction) {
|
||||
try {
|
||||
logInfo("Initialize -> Entering function.");
|
||||
|
||||
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
} catch (err) {
|
||||
logError("Initialize -> err = " + err.stack);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Fixing decimal positions to exchange configuration.
|
||||
*/
|
||||
function truncDecimals(pFloatValue) {
|
||||
let decimals = getMaxDecimalPositions();
|
||||
return parseFloat(parseFloat(pFloatValue).toFixed(decimals));
|
||||
}
|
||||
|
||||
/*
|
||||
* Return number of decimals for the current market
|
||||
*/
|
||||
function getMaxDecimalPositions() {
|
||||
return getMarketConfig().maxDecimals;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return number of decimals for the current market
|
||||
*/
|
||||
function getMarketConfig() {
|
||||
let markets = getExchangeProperties().markets
|
||||
for (let i = 0; i < markets.length; i++) {
|
||||
const market = markets[i];
|
||||
if (market.pair[0] === global.MARKET.assetA.toUpperCase() && market.pair[1] === global.MARKET.assetB.toUpperCase()) {
|
||||
return market;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return number of decimals for the current market
|
||||
*/
|
||||
function getExchangeProperties() {
|
||||
return apiClient.getExchangeProperties();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -163,29 +122,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns all the trade history from the Exchange since startTime to endTime orderd by tradeId.
|
||||
* It's possible that the exchange doesn't support this method.
|
||||
* The object returned is an array of trades:
|
||||
* trade = {
|
||||
* tradeID, String
|
||||
* globalTradeID, String
|
||||
* type, String
|
||||
* rate, Number
|
||||
* amountA, Number
|
||||
* amountB, Number
|
||||
* date Date
|
||||
* };
|
||||
*/
|
||||
function getPublicTradeHistory(assetA, assetB, startTime, endTime, callBack) {
|
||||
try {
|
||||
logInfo("getTradeHistory -> Entering function.");
|
||||
apiClient.getPublicTradeHistory(assetA, assetB, startTime, endTime, callBack);
|
||||
} catch (err) {
|
||||
logError("getTradeHistory -> err = " + err.message);
|
||||
callBack(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
function logInfo(message) {
|
||||
if (LOG_INFO === true) { logger.write(MODULE_NAME, '[INFO] ' + message) }
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="IndicatorBot.js" />
|
||||
<Compile Include="Integrations\Ecosystem.js" />
|
||||
<Compile Include="FileStorage.js" />
|
||||
<Compile Include="MultiPeriod.js">
|
||||
<SubType>Code</SubType>
|
||||
@@ -93,9 +92,6 @@
|
||||
<Content Include=".env" />
|
||||
<Content Include=".gitignore" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Integrations\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<!--Do not delete the following Import Project. While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them.-->
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="False" />
|
||||
|
||||
Reference in new issue
Block a user