Comments (8)
the ibgateway have get the client:
from ibkr.
-
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.
$ 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.
are those the complete logs?
from ibkr.
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.
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.
If you continue having problems please use this package, it's more easier I think https://github.com/maxicus/ib-tws-api
from ibkr.
ibkr:info ...... Successfully running XXXXX's services .. +3ms
ibkr:info ..................................................... +0ms
from ibkr.
Related Issues (20)
- Forex market data
- Concurrent orders
- Cannot initialize project - ibkr() is not a function and node:11784 HOT 5
- how to start IB_PORT, IB_HOST?
- Property 'on' does not exist on type 'IbkrEvents' HOT 5
- `comboLegsDescrip` in `ContractObject` should be optional HOT 2
- What's a good way to get price data (high, low, open, close, etc)? HOT 4
- Premarket orders? HOT 1
- How to contribute?
- Order values are in max_int HOT 1
- AccountSummary only returns data from 1 account for clients with multiple account IDs HOT 4
- Issues with account portfolio code HOT 7
- placeOrder - only stock are allowed HOT 4
- OrderState commission prices are incorrect scientific notation numbers HOT 1
- contract 'right' attribute is always undefined for options HOT 2
- Can't get PriceUpdates to work HOT 1
- Compatible with IBeam? HOT 2
- add option to prevent process from exiting immediately on disconnect HOT 2
- Searching securities HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ibkr.