Haehnchen / crypto-trading-bot

Cryptocurrency trading bot in javascript for Bitfinex, Bitmex, Binance, Bybit ... (public edition)
MIT License
3.09k stars 976 forks source link

Wrong configuration examples in instance.js.dist #137

Open jl2035 opened 4 years ago

jl2035 commented 4 years ago

According to this issue: https://github.com/Haehnchen/crypto-trading-bot/issues/41

...the configuration in "instance.js.dist" is wrong and misleading.

If this is true, I can volunteer to create a PR.

Nai-mul commented 4 years ago

@jl2035 please provide a solution here. I am getting error when editing api and secret key.

  (node:26535) UnhandledPromiseRejectionWarning: Error: Invalid conf.json file. Please check: SyntaxError: Unexpected string in JSON at position 1146
at Object.boot (/root/ctb/src/modules/services.js:140:13)
at Command.<anonymous> (/root/ctb/index.js:14:20)
at Command.listener (/root/ctb/node_modules/commander/index.js:370:29)
at Command.emit (events.js:314:20)
at Command.parseArgs (/root/ctb/node_modules/commander/index.js:892:12)
at Command.parse (/root/ctb/node_modules/commander/index.js:642:21)
at Object.<anonymous> (/root/ctb/index.js:49:9)
at Module._compile (internal/modules/cjs/loader.js:1201:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
at Module.load (internal/modules/cjs/loader.js:1050:32)
at Function.Module._load (internal/modules/cjs/loader.js:938:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47

(Use node --trace-warnings ... to show where the warning was created) (node:26535) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:26535) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

jl2035 commented 4 years ago

I'm not sure you are getting the same error as I was, but the solution for me was this:

https://github.com/Haehnchen/crypto-trading-bot/issues/41#issuecomment-499785249

Nai-mul commented 4 years ago

Bro Please Specify where i will add it?

jl2035 commented 4 years ago
// bitmex example
// instance.js file

let y = ['XBTU20'];

y.forEach((pair) => {
    c.symbols.push({
        'symbol': pair,
        'periods': ['15m', '1h', '1d'],
        'exchange': 'bitmex',
        'state': 'watch',
        'extra': {
            'bitmex_leverage': 4,
            'bitmex_rest_order_sync': 45000
        },
        'trade': {
            'currency_capital': 100,
            'strategies': [
                {
                    'strategy': 'macd',
                    'options': {
                        'period': '15m'
                    }
                }
            ]
        },
        'watchdogs': [
            {
                'name': 'stoploss',
                'percent': 5,
            },
            {
                'name': 'risk_reward_ratio',
                'target_percent': 5,
                'stop_percent': 5,
            }
        ]
    })
});
jordanlanch commented 4 years ago

the configuration is:

// bitmex
let y = [
    'XBTUSD', 'ETHUSD'
]

y.forEach((pair) => {
    c.symbols.push({
        'symbol': pair,
        'periods': ['1d'],
        'exchange': 'bitmex',
        'state': 'watch',
        'extra': {
            'bitmex_leverage': 2,
            'bitmex_rest_order_sync': 45000
        },
        'trade': {
          'currency_capital': 100 // trade with 1 USD dollar
        },
        'watchdogs': [
           {
               'name': 'stoploss',
               'percent': 3,
           },
           {
               'name': 'risk_reward_ratio',
               'target_percent': 3,
               'stop_percent': 3,
           }
        ],
        'strategies': [
          {
            strategy: 'trader_custom',
            options: {
              period: '1d'
            },
          },
        ]
    })
})