Half Iteration upgrading the Trading Engine (not running)

This commit is contained in:
Luis Fernando Molina committed 2020-08-01 19:37:00 +02:00
1 parent a03b025b64
commit 0b581fe837
20 files changed
+1877 -885

No files matched your search

+11 -1
View File
@@ -74,10 +74,20 @@
async function createOrder(tradingSystemOrder, tradingEngineOrder) {
let price = tradingEngineOrder.rate.value // CCXT: how much quote currency you are willing to pay for a trade lot of base currency (for limit orders only)
let amount = tradingEngineOrder.size.value // CCXT: how much of currency you want to trade
let type // CCXT: a string literal type of order, ccxt currently unifies market and limit orders only
let side // CCXT: a string literal for the direction of your order, buy or sell
let symbol = bot.market.baseAsset + '/' + bot.market.quotedAsset // CCXT: a string literal symbol of the market you wish to trade on, like BTC/USD, ZEC/ETH, DOGE/DASH, etc
let amount // CCXT: how much of currency you want to trade
/*
We need at the amount a value denominated in Base Asset, if we do not
have it, then we convert the value we have in Quoteed Asset.
*/
if (tradingEngineOrder.orderBaseAsset.size.value > 0) {
amount = tradingEngineOrder.orderBaseAsset.size.value
} else {
amount = tradingEngineOrder.orderQuotedAsset.size.value / tradingEngineOrder.rate.value
}
switch (tradingSystemOrder.type) {
case 'Market Buy Order': {