bmino / binance-triangle-arbitrage

Detect in-market cryptocurrency arbitrage
MIT License
1.1k stars 342 forks source link

Regular error in quick-format-unescaped module #46

Closed alexdruk closed 5 years ago

alexdruk commented 5 years ago

Congrats! Beautifully designed and executed module! However, I regularly getting the following error. I realized that it is not in your module, but maybe you have an idea what caused it and how to get rid of it. /home/ec2-user/arb/node_modules/quick-format-unescaped/index.js:31 var flen = f.length ^

TypeError: Cannot read property 'length' of undefined at format (/home/ec2-user/arb/node_modules/quick-format-unescaped/index.js:31:16) at Pino.LOG [as trace] (/home/ec2-user/arb/node_modules/pino/lib/tools.js:36:33) at binance.marketBuy (/home/ec2-user/arb/src/main/BinanceApi.js:36:26) at /home/ec2-user/arb/node_modules/node-binance-api/node-binance-api.js:279:27 at Request._callback (/home/ec2-user/arb/node_modules/node-binance-api/node-binance-api.js:110:16) at Request.self.callback (/home/ec2-user/arb/node_modules/request/request.js:185:22) at emitTwo (events.js:126:13) at Request.emit (events.js:214:7) at Request. (/home/ec2-user/arb/node_modules/request/request.js:1161:10) at emitOne (events.js:116:13)

alexdruk commented 5 years ago

my config: configuration: { "KEYS": { "API": "**", "SECRET": "**" }, "INVESTMENT": { "BASE": "ETH", "MIN": 0.5, "MAX": 1, "STEP": 0.5 }, "TRADING": { "ENABLED": false, "EXECUTION_STRATEGY": "linear", "EXECUTION_CAP": 10, "PROFIT_THRESHOLD": 0.3, "AGE_THRESHOLD": 300, "WHITELIST": [ "ADA", "ADX", "AE", "AGI", "AION", "AMB", "APPC", "ARDR", "ARK", "ARN", "AST", "BAT", "BCD", "BCHABC", "BCHSV", "BCPT", "BLZ", "BNB", "BNT", "BQX", "BRD", "BTG", "BTS", "BTT", "CDT", "CELR", "CMT", "CND", "CVC", "DASH", "DATA", "DCR", "DENT", "DGD", "DLT", "DNT", "DOCK", "EDO", "ELF", "ENG", "ENJ", "EOS", "ETC", "ETH", "EVX", "FET", "FUEL", "FUN", "GNT", "GO", "GRS", "GTO", "GVT", "GXS", "HC", "HOT", "ICX", "INS", "IOST", "IOTA", "IOTX", "KEY", "KMD", "KNC", "LEND", "LINK", "LOOM", "LRC", "LSK", "LTC", "LUN", "MANA", "MCO", "MDA", "MFT", "MITH", "MTH", "MTL", "NANO", "NAS", "NAV", "NCASH", "NEBL", "NEO", "NPXS", "NULS", "NXS", "OAX", "OMG", "ONG", "ONT", "OST", "PHX", "PIVX", "POA", "POE", "POLY", "POWR", "PPT", "QKC", "QLC", "QSP", "QTUM", "RCN", "RDN", "REN", "REP", "REQ", "RLC", "RVN", "SC", "SKY", "SNGLS", "SNM", "SNT", "STEEM", "STORJ", "STORM", "STRAT", "SYS", "THETA", "TNB", "TNT", "TRX", "VET", "VIA", "VIB", "VIBE", "WABI", "WAN", "WAVES", "WPR", "WTC", "XEM", "XLM", "XMR", "XRP", "XVG", "XZC", "YOYO", "ZEC", "ZEN", "ZIL", "ZRX" ] }, "HUD": { "ENABLED": false, "ARB_COUNT": 25 }, "LOG": { "LEVEL": "trace", "PRETTY_PRINT": true }, "DEPTH": { "SIZE": 50, "INITIALIZATION_INTERVAL": 50 }, "CALCULATION_COOLDOWN": 100 }

bmino commented 5 years ago

There shouldn't be a configuration: at the beginning of your config file. It should be a formatted identically to the config.json.example and renamed to config.json

Not sure if that is just how you posted your config snippet, or how it is in your source code as well?

An example config.json would look like this:

{

    "KEYS": {
        "API": "my_key_here",
        "SECRET": "my_secret_here"
    },

    "INVESTMENT": {
        "BASE": "BTC",
        "MIN": 0.015,
        "MAX": 0.035,
        "STEP": 0.005
    },

    "TRADING": {
        "ENABLED": false,
        "EXECUTION_STRATEGY": "linear",
        "EXECUTION_CAP": 1,
        "PROFIT_THRESHOLD": 0.3,
        "AGE_THRESHOLD": 300,
        "WHITELIST": [
            "BTC",
            "TRX",
            "ETH",
            ...
        ]
    },

    "HUD": {
        "ENABLED": true,
        "ARB_COUNT": 10
    },

    "LOG": {
        "LEVEL": "info",
        "PRETTY_PRINT": true
    },

    "DEPTH": {
        "SIZE": 50,
        "INITIALIZATION_INTERVAL": 50
    },

    "CALCULATION_COOLDOWN": 100

}
alexdruk commented 5 years ago

Sorry, I just posted a copy from execution.log. The code works fine, except of this regular error.

bmino commented 5 years ago

Gotcha. Would you please explain in a few steps what you are doing when you experience this error?

alexdruk commented 5 years ago

Just run the module regularly with "npm start" . I was trying to get relative frequency of different arbitrage opportunities. I continue to run now, but not getting this error for last 2 days. However it was frequent (at least twice a day) in days before.

bmino commented 5 years ago

Unfortunately I cannot reproduce this error nor am I yet to encounter it. I can't really debug much further without more info or a copy of your console output logs next time it happens

alexdruk commented 5 years ago

This is a pity. Have to investigate myself. It happens every day. Will try to upgrade to a new version

alexdruk commented 5 years ago

It seems that scripts work fine with V 5.0 You can close the issue. Thanks v. 5.0 looks great!