Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ftxFix.on('error', async err => {
- console.error(err)
- console.log('try to reconnect Ftx Fix Server later..')
- utils.sleep(3000)
- ftxFix.reconnect()
- })
- async function connectFix() {
- ftxFix.connect(err => {
- if (err) {
- throw err
- } else {
- console.log('FTX FIX connect success')
- }
- })
- await utils.sleep(5000);
- if (ftxFix.connected && ftxFix.authenticated) {
- ftxFix.subscribeReport(report => {
- console.debug(report)
- })
- }
- }
- connectFix()
- async function FIXSendOrder(future, side, price, size, ioc, clientID) {
- if (ftxFix.connected && ftxFix.authenticated) {
- ftxFix.newOrder(
- {
- ClOrdID: clientID,
- Symbol: future,
- OrdType: '2',
- OrderQty: size,
- Price: price,
- Side: side,
- TimeInForce: ioc
- },
- (err, msg) => {
- console.debug(msg)
- }
- )
- }
- await utils.sleep(1500);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement