Code Monkey home page Code Monkey logo

Comments (8)

askie avatar askie commented on June 16, 2024

the ibgateway have get the client:
image

from ibkr.

ceddybi avatar ceddybi commented on June 16, 2024

@askie

  • before you run your code can you enable the debug environment variable,
    DEBUG=ibkr* ....rest of your command /usr/local/bin/node. .... e.t.c

  • Another idea is just run the code as normal javascript, I think you are struggling with the typescript, save this file as index.js

var ibkr = require('@stoqey/ibkr').default;

var {IBKREVENTS, IbkrEvents, HistoricalData} = require('@stoqey/ibkr');

const ibkrEvents = IbkrEvents.Instance;

ibkr() // add your port and  host if you want
    .then((started) => {
        console.log('done', started);
        const symbol = 'PPSI';

        HistoricalData.Instance; // initialize HistoricalData module
        // Request for market data
        ibkrEvents.emit(IBKREVENTS.GET_MARKET_DATA, {
            symbol,
            whatToShow: 'TRADES',
            durationStr: '3600 S',
            barSizeSetting: '5 secs',
        });

        // get the market data
        ibkrEvents.on(IBKREVENTS.ON_MARKET_DATA, async ({symbol, marketData}) => {
            console.log('data', {symbol, marketData: marketData.length});
        });
    })
    .catch((e) => {
        console.log('error starting  ibkr', e);
    });

you can run this code as simply as node index.js, with the debug env run it like DEBUG=ibkr* node index.js

from ibkr.

askie avatar askie commented on June 16, 2024
$ DEBUG=ibkr* node dist/index.js
  ibkr:info ................................................................. +0ms
  ibkr:info ...... Connected client 73267, initialising services ...... +1ms
  ibkr:info 1. Account summary +0ms
  ibkr:info error Sec-def数据农场连接正常:secdefhk +9ms
  ibkr:info accountSummaryEnd { AccountId: '***', tickerId: 7162, accountReady: false } +108ms
  ibkr:info 2. Portfolios +5ms
  ibkr:info AccountID *** +1ms
  ibkr:info logPortfolio:LOSS shares = 30, costPerShare -> 15433.8 marketPrice -> 34.7609329 3690 432669963 +14ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +5ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +0ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +0ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +0ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +1ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +0ms

can not see the then function working

from ibkr.

ceddybi avatar ceddybi commented on June 16, 2024

are those the complete logs?

from ibkr.

askie avatar askie commented on June 16, 2024

after I delete my account ID ,below:

  ibkr:info ................................................................. +0ms
  ibkr:info ...... Connected client 73267, initialising services ...... +1ms
  ibkr:info 1. Account summary +0ms
  ibkr:info error Sec-def数据农场连接正常:secdefhk +9ms
  ibkr:info accountSummaryEnd { AccountId: '***', tickerId: 7162, accountReady: false } +108ms
  ibkr:info 2. Portfolios +5ms
  ibkr:info AccountID *** +1ms
  ibkr:info logPortfolio:LOSS shares = 30, costPerShare -> 15433.8 marketPrice -> 34.7609329 3690 432669963 +14ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +5ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +0ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +0ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +0ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +1ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +0ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +0ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +2ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +1ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +1ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +0ms
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +0ms
  ibkr:info 3. Orders +10ms
  ibkr:info logPortfolio:LOSS shares = 30, costPerShare -> 15433.8 marketPrice -> 34.95755005 3690 432669963 +1m
  ibkr:verbose getPortfolios positionEnd ********************** = 10 +1m
  ibkr:info error IB与Trader Workstation的连接中断。 +41s

from ibkr.

ceddybi avatar ceddybi commented on June 16, 2024

Those are not complete, please look carefully you should see something like this

  ibkr:info ...... Successfully running XXXXX's services .. +3ms
  ibkr:info ..................................................... +0ms

After these lines, you will see the output of your code

from ibkr.

ceddybi avatar ceddybi commented on June 16, 2024

If you continue having problems please use this package, it's more easier I think https://github.com/maxicus/ib-tws-api

from ibkr.

askie avatar askie commented on June 16, 2024

image
I can't see the log:

ibkr:info ...... Successfully running XXXXX's services .. +3ms
  ibkr:info ..................................................... +0ms

from ibkr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.