Releases: zerodha/kiteconnectjs
v4.1.0
Features
What's Changed
- replace ; with , and removing unused variable by @bhavyasf in #73
- feat: add all mode ticker unitTests by @ranjanrak in #74
- fix(examples/connect): declare kc (kiteconnect client) with let and shorten expression in
ticker.js
by @bhavyasf in #75 - feat: expose onmessage event callback by @ranjanrak in #79
- remove unused function by @bhavyasf in #81
- fix: add missing parameter documentation by @marsonya in #83
- chore: update kiteconnect login URL by @ranjanrak in #82
- chore: remove stale docs artifacts by @rhnvrm in #86
- feat: add doc generation steps in readme by @ranjanrak in #87
- feat: add getAuctionInstruments, variety in place order, auction tests and update submodule by @ranjanrak in #90
- feat: add unit tests for order charges by @ranjanrak in #91
New Contributors
- @bhavyasf made their first contribution in #73
- @marsonya made their first contribution in #83
- @rhnvrm made their first contribution in #86
Full Changelog: v4.0.1...v4.1.0
v4.0.1
- Added tests
- Added iceberg and TTL order params to docs
v4.0.0
Breaking changes
v4 is a breaking major release with multiple changes
- Upgrade deps and set minimum nodejs version to 8.0.0+
- Return promise instead of throwing error on generateSession and renewAccessToken
- Handle gtt payload validation and throw proper error
- Change ticker response attributes naming as per kite connect doc
What's Changed
- feat: Add order margin end-point by @ranjanrak in #37
- Bugfixes and v3.2.0 by @vividvilla in #39
- feat: add websocket example explaining all event callbacks by @ranjanrak in #43
- Added Syntax Highlighting To README Code Blocks. by @deve-sh in #44
- fix: instrument format for getQuote, getOHLC and getLTP in comment block by @ranjanrak in #45
- feat: add basket order margins by @ranjanrak in #49
- Review by @ranjanrak in #53
- feat: add OI param to getHistorical by @vividvilla in #52
- upgrade deps and set minimum nodejs version by @vividvilla in #51
- fix: add BCD price divisor for ticker by @ranjanrak in #58
- feat: update ticker_attributes naming as per API doc by @ranjanrak in #59
- chore(deps): bump axios from 0.21.1 to 0.21.2 by @dependabot in #60
- chores: update changelog and readme for v4 release by @ranjanrak in #61
New Contributors
- @ranjanrak made their first contribution in #37
- @deve-sh made their first contribution in #44
Full Changelog: v3.1.0...v4.0.0
Bugfixes
v3.1.0 chore: upgrade version to v3.1.0
Bug fixes
- fix: historical excluding last candle
- fix: exitOrder missing return statement
Kite connect 3.0.0
Kite connect 3.0.0 beta 2
Documentation
Installation
npm install kiteconnect@beta
New features
- method:
getProfile
- method:
getOHLC
- method:
getLTP
- method:
getInstrumentsMargins
- Added MF API calls
- method:
getMFOrders
- method:
getMFHoldings
- method:
placeMFOrder
- method:
cancelMFOrder
- method:
getMFSIPS
- method:
placeMFSIP
- method:
modifyMFSIP
- method:
cancelMFSIP
- method:
getMFInstruments
- method:
exitOrder
- method:
renewAccessToken
- method:
invalidateRefreshToken
- constants for products, order type, transaction type, variety, validity, exchanges and margin segments
API method name changes
v2 | v3 |
---|---|
requestAccessToken | generateSession |
invalidateToken | invalidateAccessToken |
setSessionHook | setSessionExpiryHook |
loginUrl | getLoginURL |
margins | getMargins |
orderPlace | placeOrder |
orderModify | modifyOrder |
orderCancel | cancelOrder |
orders | getOrders |
orders(order_id) | getOrderHistory |
trades | getTrades |
trades(order_id) | getOrderTrades |
holdings | getHoldings |
positions | getPositions |
productModify | convertPosition |
instruments | getInstruments |
historical | getHistoricalData |
triggerRange | getTriggerRange |
Params and other changes
KiteConnect
takes all the params as object includingapi_key
convertPosition
method takes all the params as object- All success response returns only
data
field in response instead with envelope - All error thrown are in the format of
{"message": "Unknown error", "error_type": "GeneralException", "data": null}
- Changes in
generateSession
response structure - Changes in
getPositions
response structure - Changes in
getQuote
response structure - Changes in
placeOrder
params - Changes in
getHistoricalData
params - All datetime string fields has been converted to
Date
object.getOrders
,getOrderHistory
,getTrades
,getOrderTrades
,getMFOrders
responses fieldsorder_timestamp
,exchange_timestamp
,fill_timestamp
getMFSIPS
fieldscreated
,last_instalment
generateSession
fieldlogin_time
getQuote
fieldstimestamp
,last_trade_time
getInstruments
fieldexpiry
getMFInstruments
fieldlast_price_date
KiteTicker changes
KiteTicker
receives paramaccess_token
instead ofpublic_token
- New params addedd to
KiteTicker
initializerreconnect
- Toggle auto reconnect on/offmax_retry
- Max retry count for auto reconnectmax_delay
- Max delay between subsequent retries- Auto reconnect is enabled by default
- Renamed callback
reconnecting
toreconnect
- Added new callbacks
error
- when socket connection is closed with error. Error is received as a first paramclose
- when socket connection is closed cleanlyorder_update
- When order update (postback) is received for the connected user (Data object is received as first argument)
Bug fixes and added postback checksum validation method
Autoreconnect feature for WebSocket client
Auto re-connect WebSocket client
Optionally you can enable client side auto reconnection to automatically reconnect if the connection is dropped.
It is very useful at times when client side network is unreliable and patchy.
All you need to do is enable auto reconnection with preferred interval and time. For example
// Enable auto reconnect with 5 second interval and retry for maximum of 20 times.
ticker.autoReconnect(true, 20, 5)
// You can also set reconnection times to -1 for inifinite reconnections
ticker.autoReconnect(true, -1, 5)
-
Event
reconnecting
is called when auto reconnection is triggered and event callback carries two additional paramsreconnection interval set
andcurrent reconnection count
. -
Event
noreconnect
is called when number of auto reconnections exceeds the maximum reconnection count set. For example if maximum reconnection count is set as20
then after 20th reconnection this event will be triggered. Also note that the current process is exited when this event is triggered. -
Event
connect
will be triggered again when reconnection succeeds.
Here is an example demonstrating auto reconnection.
var KiteTicker = require("kiteconnect").KiteTicker;
var ticker = new KiteTicker(api_key, user_id, public_token);
// set autoreconnect with 10 maximum reconnections and 5 second interval
ticker.autoReconnect(true, 10, 5)
ticker.connect();
ticker.on("tick", setTick);
ticker.on("connect", subscribe);
ticker.on("noreconnect", function() {
console.log("noreconnect")
});
ticker.on("reconnecting", function(reconnect_interval, reconnections) {
console.log("Reconnecting: attempet - ", reconnections, " innterval - ", reconnect_interval);
});
function setTick(ticks) {
console.log("Ticks", ticks);
}
function subscribe() {
var items = [738561];
ticker.subscribe(items);
ticker.setMode(ticker.modeFull, items);
}
v1.1.0
Added disconnect
method for websocket.