rafaelwdornelas / Foxbit_Bot

Bot Automatic Trader Foxbit - Buy & Sell.
72 stars 56 forks source link

para o bot do nada #12

Open thiagotxd opened 7 years ago

thiagotxd commented 7 years ago

image não sei o que pode ser.

thiagotxd commented 7 years ago

Server running at: http://localhost:3000 [3:02:38] OB:DELETE_ORDER:sell:5 C:\Foxbit_Bot\index.js:228 for (i = 0 ; i < variables.orderbooktemp.asks.length ;i++) ^

ReferenceError: i is not defined at EventEmitter.onOrderBookDeleteOrder (C:\Foxbit_Bot\index.js:228:12) at EventEmitter.emit (C:\Foxbit_Bot\node_modules\eventemitter2\lib\eventemitter2.js:358:22) at C:\Foxbit_Bot\node_modules\blinktrade\lib\ws.js:274:44 at Array.map (native) at Object.subscribeEvent [as callback] (C:\Foxbit_Bot\node_modules\blinktrade\lib\ws.js:255:25) at BlinkTradeWS.dispatchPromise (C:\Foxbit_Bot\node_modules\blinktrade\lib\wsTransport.js:177:85) at BlinkTradeWS.onMessage (C:\Foxbit_Bot\node_modules\blinktrade\lib\wsTransport.js:170:12) at WebSocket.onMessage (C:\Foxbit_Bot\node_modules\ws\lib\WebSocket.js:442:14) at emitTwo (events.js:125:13) at WebSocket.emit (events.js:213:7) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! foxbitbot@2.0.0 start: node index.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the foxbitbot@2.0.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\tx\AppData\Roaming\npm-cache_logs\2017-06-15T18_02_38_526Z-debug.log

C:\Foxbit_Bot>

eduardofx commented 7 years ago

Corrigido

https://github.com/eduardofx/Foxbit_Bot

image

enriquevago commented 6 years ago

Edu seguinte estava tentando rodar o git principal e acabei encontrando o seu corrigido porem o bot nao segue pelo que li é algo relacionado aquelas condiçoes catch logo abaixo !

Description: Buy and sell automatic foxbit exchange Version: 2.0.0


(node:9662) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): [object Object] (node:9662) [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.

} variables.LedgerIDs.FOX = ledger['LedgerListGrp'][0].LedgerID; } }); } catch (e) { console.log(e); } }

//get orderbook function myorders() { try { blinktrade.myOrders().then(function(myOrders) { variables.orderstemp = myOrders['OrdListGrp'] }); } catch (err) { console.log("Orderbook GET", err) } }

marcelloinfoweb commented 6 years ago

@eduardofx Funciona bem, mas quando crio uma compra retorna essa mensagem, poderia ajudar?

Obrigado


/run/media/msc/7A6C0E556C0E0D17/foxbitBot/node_modules/blinktrade/lib/wsTransport.js:221 throw new Error('Error: ' + data.Detail + ' ' + data.Description); ^

Error: Error: 16 messages in the last second Too many messages per second at BlinkTradeWS.onMessage (/run/media/msc/7A6C0E556C0E0D17/foxbitBot/node_modules/blinktrade/lib/wsTransport.js:221:15) at WebSocket.onMessage (/run/media/msc/7A6C0E556C0E0D17/foxbitBot/node_modules/ws/lib/EventTarget.js:103:16) at emitTwo (events.js:126:13) at WebSocket.emit (events.js:214:7) at Receiver._receiver.onmessage (/run/media/msc/7A6C0E556C0E0D17/foxbitBot/node_modules/ws/lib/WebSocket.js:146:54) at Receiver.dataMessage (/run/media/msc/7A6C0E556C0E0D17/foxbitBot/node_modules/ws/lib/Receiver.js:389:14) at Receiver.getData (/run/media/msc/7A6C0E556C0E0D17/foxbitBot/node_modules/ws/lib/Receiver.js:330:12) at Receiver.startLoop (/run/media/msc/7A6C0E556C0E0D17/foxbitBot/node_modules/ws/lib/Receiver.js:165:16) at Receiver.add (/run/media/msc/7A6C0E556C0E0D17/foxbitBot/node_modules/ws/lib/Receiver.js:139:10) at TLSSocket._ultron.on (/run/media/msc/7A6C0E556C0E0D17/foxbitBot/node_modules/ws/lib/WebSocket.js:142:22) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! foxbitbot@2.0.0 start: node index.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the foxbitbot@2.0.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/msc/.npm/_logs/2017-12-23T19_22_38_441Z-debug.log

wendellpalazzo commented 6 years ago

Olá... tive esse problema.. e outros que já foram reportados aqui.. resolvi fazendo assim:

atualizei o node e npm removi o node_modules removi o cache do npm depois só dar um npm install e quando for rodar o index.js.. use este comando: NODE_ENV=production node index.js (este evita o problema q reportaram de erro LyfeCicle)

WinGGAp commented 6 years ago

@wendellpalazzo O comando seria: "SET NODE_ENV=production node index.js"? E como faz pra remover o node_modules?

wendellpalazzo commented 6 years ago

Não, apenas o comando: NODE_ENV=production node index.js

basta remover a pasta node_modules mesmo... deletando ela..

Qualquer dúvida só falar,

Um abraço!

Att,

Wendell Palazzo Developer FullStack - WEB e Mobile (iOS e Android) 62 9121-9680 (claro - whatsapp) Skype: wendell.palazzo

Wendell Palazzo about.me/wendellpalazzo

2018-01-06 0:24 GMT-02:00 WinGGAp notifications@github.com:

@wendellpalazzo O comando seria: "SET NODE_ENV=production node index.js"? E como faz pra remover o node_modules?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

WinGGAp commented 6 years ago

@wendellpalazzo Ao colocar o comando "NODE_ENV=production node index.js" ![image](https://user-images.githubusercontent.com/27193361/34636308-a302f1de-f285-11e7-8688-3e508cf09018.png.

wendellpalazzo commented 6 years ago

@WinGGAp me desculpa!!! O certo é o que vc indicou mais acima: O comando seria: "SET NODE_ENV=production node index.js"?

pq vc está usando WINDOWS.. estou num mac.. e então n precisa do comando "SET"... 👍

marcelloinfoweb commented 6 years ago

Esta iniciando mas quando eu ativo pra comprar, não adiciona minha ordem de compra, nem de vendas. Não aparece no sistema e nem na FoxBit. O que pode ser?

capturadetelade2018-01-0615-43-31

wendellpalazzo commented 6 years ago

@marcelloinfoweb Cara as vezes demora entrar ... se vc ver no console ira ver vários comandos sendo executados... do tipo "BUY" "Buy:CHECK" e no padrao faz a cada 2s...

o problema eh q as vezes dá um erro de "16 messages in seconds.. to many messages".. isso pq a plataforma Blinktrade tem esta configuração.. para n dar tanto problema. .estou colocando coloco 3..5s

mais um detalhe.. estou usando o pullrequest que o @eduardofx corrigiu

marcelloinfoweb commented 6 years ago

Não entendi, onde eu altero esse intervalo?

wendellpalazzo commented 6 years ago

Dentro do arquivo index.js procure por setInterval(requestLedger,3000) então está vindo 5000 (5s) estou usando 10000 (10s) e setInterval(myorders, 2000) está vindo 2000 (2s) estou usando 5000 (5s)

depois restarte o processo lá no console

marcelloinfoweb commented 6 years ago

Infelizmente não funcionou, minha ordem não é adicionada.

Poderia mandar um print do seu sistema funcionando, só pra eu tirar a minha dúvida. Estou usando o sistema do @eduardofx com as alterações que você recomendou.

Obrigado.

wendellpalazzo commented 6 years ago

@marcelloinfoweb Cara.. acho q percebi uma coisa.. o bot só funciona quando o preço atual está dentro da faixa de mínima e máxima.. ou seja.. no momento que vc colocou uma min e max então irá verificar se tem ofertas para este intervalo... caso contrário n.. então quando vc muda qualquer informação dos inputs, somente na próxima verificação (que está dentro dos intervals) então irá ver uma nova opção de ofertas...

eu n tive muito tempo pra estudar todo o código.. apenas tentar fazer rodar.. saca?

wendellpalazzo commented 6 years ago

captura de tela 2018-01-08 as 00 02 08

wendellpalazzo commented 6 years ago

@marcelloinfoweb Cara fiz um teste.. e até acabei perdendo um momento bom de compra mas tá bom agora tb sei como este script tá funcionando.

Ele verifica sempre o valor atual.. a partir dele ele vai comparar com o seu MINIMO (ou buy ou sell) e então irá tentar deixar vc como comprador ou vendedor sempre no inicio.. ajustando sempre de acordo com o livro de ofertas... agora sim.. até pra mim o entendimento ficou esclarecido rsrsr agora vai!!!!

marcelloinfoweb commented 6 years ago

Vlw, me esclareceu também, vou fazer alguns testes aqui!

marcelloinfoweb commented 6 years ago

Olha só meu log no terminal:

[12:34:30] OB:DELETE_ORDER:sell:1 BUY.Check4: false BUY.active: true BUY.OrderID: 0 BUY.Check1: true price: 54302.11 amount: 0.000001 onExecutionReportRejected { OrderID: null, Volume: 0, ExecID: null, ExecType: '8', OrdStatus: '8', LeavesQty: 0, Symbol: 'BTCBRL', OrderQty: 100, LastShares: 0, LastPx: 0, Side: '1', TimeInForce: '1', CumQty: 0, MsgType: '8', ClOrdID: 9144538, OrdType: '2', OrdRejReason: '3', CxlQty: 0, Price: 5430211000000, ExecSide: '1', AvgPx: 0 }


[12:34:32] Foxbit Order Rejected: [12:34:32] Order Type: Buy [12:34:32] Order Symbol: BTCBRL [12:34:32] Order Value: 0.000543


[12:34:32] Foxbit Creating Purchase Order: Amount: 0.000001 BTC | Price: 54302.11 BRL

Não sei o que tem de errado.

wendellpalazzo commented 6 years ago

Cara.. acho q seja o amount.. tem um limite mínimo de: "orders with amount below 0.0001 BTC"

marcelloinfoweb commented 6 years ago

Então, tenho que depositar mais Real, na cotação atual um pouco mais de 5 reais. Interessante.

wendellpalazzo commented 6 years ago

sim.. pra facilitar pega o seu investimento e divide pelo valor atual do bitcoin em real.. assim vai ter a quantidade em btc q vc vai ter baseado no investimento

Qualquer dúvida só falar,

Um abraço!

Att,

Wendell Palazzo Developer FullStack - WEB e Mobile (iOS e Android) 62 9121-9680 (claro - whatsapp) Skype: wendell.palazzo

[image: --]

Wendell Palazzo [image: https://]about.me/wendellpalazzo https://about.me/wendellpalazzo?promo=email_sig&utm_source=email_sig&utm_medium=email_sig&utm_campaign=external_links

2018-01-08 0:49 GMT-02:00 Marcello Infoweb notifications@github.com:

Então, tenho que depositar mais Real, na cotação atual um pouco mais de 5 reais. Interessante.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rafaelwdornelas/Foxbit_Bot/issues/12#issuecomment-355875651, or mute the thread https://github.com/notifications/unsubscribe-auth/AAvLIDzQFStRUexWvHT6QzOtis4H_ahFks5tIYJVgaJpZM4N4uHo .