Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
6ce9705
Added new MF endpoints, fixed order delete http method from PUT to DE…
vishnus Mar 28, 2020
1596d8a
Typo correction in comments
vishnus Mar 28, 2020
5646eb9
Merge pull request #19 from vishnus/mf_new_endpoints
vividvilla Mar 28, 2020
48260e9
fix: test failiure for cancel mf sip
rhnvrm Mar 30, 2020
5f92e86
Merge pull request #20 from rhnvrm/fix/mf-cancel-sip-test-fail
vividvilla Mar 31, 2020
eba0269
chore: support for go modules
rhnvrm Jul 31, 2020
ec64e28
Merge pull request #22 from rhnvrm/gomod-fixes
vividvilla Aug 21, 2020
1e9c272
feat: Add trigger_price and GetMFOrdersByDate
rhnvrm Aug 21, 2020
c8a84fb
Merge pull request #23 from rhnvrm/mf-date
vividvilla Oct 22, 2020
a7af864
feat: add order-margins API
rhnvrm Nov 9, 2020
c7cbff6
Merge pull request #25 from rhnvrm/order-margins
vividvilla Nov 12, 2020
dfd6028
Add DeepSource config
de-sh Nov 21, 2020
d281922
Remove unnecessary guard around delete
de-sh Nov 21, 2020
a93d7a2
Replace time.Now().Sub() with time.Since()
de-sh Nov 21, 2020
4734fdd
Remove unused orderMarginRequest type
de-sh Nov 21, 2020
3b8e6da
replace len(s)==0 with s==''
de-sh Nov 21, 2020
58557c1
refactor to using else if without unnecessary nesting
de-sh Nov 22, 2020
019db6f
Reconfigure DeepSource config
de-sh Dec 9, 2020
c3f745f
Remove DeepSource config
de-sh Dec 11, 2020
677d9c0
Merge pull request #27 from de-sh/master
vividvilla Dec 18, 2020
3db847c
Updated mock response (#31)
bhumitattarde Feb 8, 2021
f59cdd9
Add OI support to Historical Data (#29)
VarunBatraIT Feb 8, 2021
6c6f670
delete: mock responses
rhnvrm May 28, 2021
34178e3
chore: switch mock_responses to submodule
rhnvrm May 28, 2021
4638eb0
fix: missing tags in order response
rhnvrm Jun 1, 2021
7837e2a
feat: add github actions, remove travis
rhnvrm Jun 1, 2021
930e971
tests: added tests for historical data with OI
rhnvrm Jun 1, 2021
d18b433
Merge pull request #36 from zerodha/develop
vividvilla Jun 1, 2021
023b857
fix: update module name to match repo url
rhnvrm Jun 8, 2021
677801f
chore: update mock_responses
rhnvrm Jun 14, 2021
164a25e
fix: change qty from string->int in pos conversion
rhnvrm Jun 14, 2021
39fad36
feat: models package
rhnvrm Jun 16, 2021
7b64629
refactor: gracefully exit ticker
rhnvrm Jun 16, 2021
ee286fc
feat: initiate holdings response call
rhnvrm Jun 22, 2021
2ca76e5
feat: generate and return redirectURL for holAuth
rhnvrm Jun 22, 2021
22a9a36
feat: add type, transfertype, exec_date to holAuth
rhnvrm Jun 23, 2021
b334290
Merge pull request #43 from rhnvrm/exit-goroutines
vividvilla Jun 30, 2021
51022e4
feat: add consts for HolAuth type/trfrType
rhnvrm Jun 30, 2021
3230fb5
Merge pull request #45 from rhnvrm/holding-auth
vividvilla Jun 30, 2021
f22ce09
refactor: timestamp parsing logic
rhnvrm Jun 30, 2021
eeb8293
fix: update mock responses for mf
rhnvrm Jun 30, 2021
0fbc8c9
refactor: move trimming logic outside parsing
rhnvrm Jun 30, 2021
3fcd6f3
refactor, test: simplify zone parsing, unit test
rhnvrm Jun 30, 2021
bef866f
Merge pull request #47 from rhnvrm/parse-time-local
vividvilla Jun 30, 2021
6cc478a
chore: update gomodule version from v3 -> v4
rhnvrm Jun 30, 2021
ee2b18b
Merge pull request #48 from rhnvrm/module-v4
vividvilla Jun 30, 2021
41ec8fd
readme.md : Add extra step update submodules before tests
kalbhor Jul 1, 2021
ce90227
Merge pull request #49 from kalbhor/documentation
knadh Jul 2, 2021
8993577
Develop (#51)
kalbhor Jul 2, 2021
a71d285
Added missing fields in mutualfunds SIP structs and UserProfile (#57)
vishnus Jul 9, 2021
32da450
fix: dont change http status code in readEnvelope (#58)
rhnvrm Jul 9, 2021
d9da4ac
tests: add test for ticker/parsePacket (#55)
rhnvrm Jul 9, 2021
eb18116
fix: log only if non Error errors in readEnvelope (#59)
rhnvrm Jul 12, 2021
34a5f96
feat: add compact mode margin and basket order margins
ranjanrak Jul 6, 2021
f1173a6
Merge branch 'ranjanrak-develop' into develop
rhnvrm Jul 14, 2021
03978e0
Merge branch 'master' into develop
rhnvrm Jul 16, 2021
bb43544
Merge pull request #60 from zerodha/develop
vividvilla Jul 16, 2021
679ad41
chore: bump gorilla/websocket from 1.4.0 to 1.4.2
rhnvrm Jul 27, 2021
1605b19
fix: incorrect custom time json unmarshalling
rhnvrm Aug 16, 2021
f3e8abd
Merge pull request #65 from rhnvrm/fix-issue-64
vividvilla Aug 16, 2021
b71fbd9
Merge pull request #62 from rhnvrm/gorilla-ws
vividvilla Aug 16, 2021
43d0423
fix: json tag for low in Historical Data (#66)
techie-subhadeep Sep 1, 2021
ecdae7d
fix: position type const, comment for timestamp (#67)
ranjanrak Sep 2, 2021
5bcf7ad
bump: version const to v4.0.2
rhnvrm Sep 2, 2021
c10e201
fix: handle price conversion for BCD segment (#68)
rhnvrm Sep 27, 2021
ca4fdfb
fix: MFSipParams SipType type fix (#69)
vishnus Sep 27, 2021
acc6b64
feat: add new margin fields - live_balance and opening_balance (#70)
vividvilla Sep 30, 2021
d33d473
fix: update missing response fields for userprofile
ranjanrak Oct 4, 2021
0d6d0e4
fix: update ticker example with v4
ranjanrak Oct 4, 2021
82425c6
feat: add SetMode usage in ticker example
ranjanrak Oct 4, 2021
e6dc732
Merge pull request #72 from ranjanrak/update-ticker-readme
vividvilla Oct 5, 2021
47e313e
feat: add delivery margin field
ranjanrak Oct 5, 2021
3002297
Merge pull request #71 from ranjanrak/update-profile-fields
vividvilla Oct 5, 2021
51592a6
fix: update holdings struct (#73)
ranjanrak Oct 12, 2021
b2874ec
chore: bump mock_responses (#75)
rhnvrm Nov 17, 2021
f966e99
feat: add unit tests for CancelOrder and SessionInvalidate (#74)
ranjanrak Nov 17, 2021
fdbe590
fix: ambigous user_id in json parsing (#77)
rhnvrm Mar 21, 2022
7f5d702
fix: negative or zero reconnect delay on higher reconnects (#78)
utekaravinash Apr 27, 2022
0542f81
feat: add support for iceberg and ttl orders
rhnvrm May 19, 2022
7e68d7f
Merge pull request #79 from rhnvrm/iceberg-plus-ttl
vividvilla May 19, 2022
831f065
feat: add iceberg + validity to order params
rhnvrm May 19, 2022
3d5cad6
Merge pull request #80 from zerodha/iceberg-plus-ttl
vividvilla May 19, 2022
12e187e
chore: update test version matrix to 1.14->1.18 (#81)
rhnvrm May 24, 2022
871201c
fix: Order Response struct for ice-berg orders
ranjanrak May 24, 2022
c721c03
chores: add ice-berg and TTL unit test cases
ranjanrak May 24, 2022
70ece4d
Merge pull request #82 from ranjanrak/fix-ice_berg
rhnvrm May 24, 2022
bd65704
chore: improve ticker example with envVars
rhnvrm May 26, 2022
5c181e5
Merge pull request #85 from rhnvrm/chore-ticker-eg-env-vars
rhnvrm May 26, 2022
ed2d86f
chore: SetMode usage in README and update ticker example (#86)
ranjanrak Aug 22, 2022
08b25bd
test: add test for null time (#87)
rhnvrm Aug 25, 2022
4f5b2b3
chore: update kiteconnect login URL (#89)
ranjanrak Dec 7, 2022
f8cc136
feat: add GetAuctionInstruments (#91)
ranjanrak Dec 22, 2022
978f71a
feat: add auction fields & variety in place order
ranjanrak Dec 22, 2022
39bd8cd
feat: add tests for all order varieties
ranjanrak Dec 22, 2022
03ff18c
Merge pull request #92 from ranjanrak/auction-order
rhnvrm Dec 22, 2022
c7d61dd
feat: add charges,leverage and unit tests for order margins
ranjanrak Jan 7, 2023
91146a1
Merge pull request #93 from ranjanrak/feat-charges
vividvilla Jan 9, 2023
4fe848f
feat: include modified field in order response
ranjanrak Jun 13, 2023
f11d290
Merge branch 'ranjanrak-order-auction'
rhnvrm Jun 15, 2023
afccd9c
feat: APIs for order charges
Jul 27, 2023
6bce21f
chore: lint changes
Jul 27, 2023
84ababc
chore: lint changes
Jul 27, 2023
a881e5c
fix: add input testcase corresponding to mock response
Jul 27, 2023
b10c58a
fix: add input testcase corresponding to mock response
Jul 27, 2023
fb2f9fb
fix: pass unique order_id in test cases
Jul 28, 2023
1eb9eba
Merge pull request #97 from kalbhor/master
rhnvrm Aug 1, 2023
f07f57d
fix: synchronize access to lastPingTime in ticker struct (#99)
abhinandkakkadi Aug 31, 2023
d36ecde
feat: Add Full User Profile
johnnybravo-xyz Nov 21, 2023
4ffcb43
feat: Update mock response for Full User Profile
johnnybravo-xyz Nov 21, 2023
b759000
Add FullUserMeta for full user profile
johnnybravo-xyz Nov 21, 2023
1612a1a
Make timestamps time object
johnnybravo-xyz Nov 21, 2023
970add1
Fix tests hash
johnnybravo-xyz Nov 21, 2023
4874af5
Merge pull request #101 from johnnybravo-xyz/master
vividvilla Nov 21, 2023
b92bf55
feat: allow setting product type for GTT orders
imJayanth Apr 29, 2024
06945e3
chore: update and fix broken go-test.yml (#105)
rhnvrm May 29, 2024
d1eafbf
Add `GetLoginURLWithparams()` to support `redir_params`.
knadh Dec 24, 2024
ac470f7
fix: genHolAuthURL auth URL and json tag
ranjanrak Dec 17, 2024
5b581b7
Merge pull request #107 from ranjanrak/fix-genHolAuthURL
ranjanrak Dec 27, 2024
8164b31
Merge pull request #109 from zerodha/redir-params
ranjanrak Dec 27, 2024
36d35f4
feat: add mtf in holdings and orders
Jan 17, 2025
5f70273
Merge pull request #110 from zerodha/feat-mtf
ranjanrak Jan 17, 2025
fd4c0d6
feat: add support for setting custom app name in useragent
rhnvrm Jun 11, 2025
fe526ba
feat: implement Alerts API
rhnvrm Jun 11, 2025
b95c3bd
feat: add examples and rename DeleteAlerts
ranjanrak Jun 12, 2025
3616cd8
Merge branch 'pr-120' into chore-release-prep-sep
rhnvrm Sep 15, 2025
a3a3039
feat: add GetHoldingsSummary and GetHoldingsCompact methods
rhnvrm Sep 15, 2025
488934d
feat: add market protection field to OrderParams
rhnvrm Sep 15, 2025
24652cb
feat: add mocks and tests for holdings summary and compact
ranjanrak Sep 18, 2025
eda2c34
feat: add autoslice support for order placement
rhnvrm Mar 25, 2026
cee890b
chore: fix CI and resolve go vet warnings
rhnvrm Mar 25, 2026
13a0a5b
feat: add market_protection and guid to Order response struct
rhnvrm Mar 25, 2026
68cf7ca
fix: use models.OHLC in alerts, add test clarification
rhnvrm Mar 25, 2026
f328675
refactor: upgrade httpmock and modernize test infrastructure
rhnvrm Mar 25, 2026
eddc788
feat: add MarketProtectionAuto constant
rhnvrm Mar 25, 2026
636aaf2
fix(auth): set access token on successful session exchange
rhnvrm Mar 28, 2026
fab6d85
Merge pull request #123 from zerodha/chore-release-prep-sep
rhnvrm Mar 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Go Test

on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]

jobs:
test:
strategy:
matrix:
go-version: ["1.21", "1.22", "1.23", "1.24"]
platform: [ubuntu-latest]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
check-latest: true

- name: Run Go Vet
run: go vet ./...

- name: Run Go Test
run: go test -v ./...
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.chglog
.chglog
.env
.vscode
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "mock_responses"]
path = mock_responses
url = https://github.com/zerodha/kiteconnect-mocks
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

71 changes: 0 additions & 71 deletions CHANGELOG.md

This file was deleted.

52 changes: 36 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@

The official Go client for communicating with the Kite Connect API.

Kite Connect is a set of REST-like APIs that expose many capabilities required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio, stream live market data (WebSockets), and more, with the simple HTTP API collection.
Kite Connect is a set of REST-like APIs that expose many capabilities required
to build a complete investment and trading platform. Execute orders in real
time, manage user portfolio, stream live market data (WebSockets), and more,
with the simple HTTP API collection.

Zerodha Technology (c) 2018. Licensed under the MIT License.
Zerodha Technology (c) 2021. Licensed under the MIT License.

## Documentation

- [Client API documentation - GoDoc](https://godoc.org/github.com/zerodhatech/gokiteconnect)
- [Client API documentation - GoDoc](https://godoc.org/github.com/zerodha/gokiteconnect)
- [Kite Connect HTTP API documentation](https://kite.trade/docs/connect/v3)

## Installation

```
go get github.com/zerodhatech/gokiteconnect
go get github.com/zerodha/gokiteconnect/v4
```

## API usage
Expand All @@ -25,7 +28,7 @@ package main
import (
"fmt"

"github.com/zerodhatech/gokiteconnect"
kiteconnect "github.com/zerodha/gokiteconnect/v4"
)

const (
Expand Down Expand Up @@ -71,14 +74,19 @@ import (
"fmt"
"time"

kiteconnect "github.com/zerodhatech/gokiteconnect"
"github.com/zerodhatech/gokiteconnect/ticker"
kiteconnect "github.com/zerodha/gokiteconnect/v4"
kitemodels "github.com/zerodha/gokiteconnect/v4/models"
kiteticker "github.com/zerodha/gokiteconnect/v4/ticker"
)

var (
ticker *kiteticker.Ticker
)

var (
instToken = []uint32{408065, 112129}
)

// Triggered when any error is raised
func onError(err error) {
fmt.Println("Error: ", err)
Expand All @@ -92,14 +100,21 @@ func onClose(code int, reason string) {
// Triggered when connection is established and ready to send and accept data
func onConnect() {
fmt.Println("Connected")
err := ticker.Subscribe([]uint32{53718535})
err := ticker.Subscribe(instToken)
if err != nil {
fmt.Println("err: ", err)
}
// Set subscription mode for the subscribed token
// Default mode is Quote
err = ticker.SetMode(kiteticker.ModeFull, instToken)
if err != nil {
fmt.Println("err: ", err)
}

}

// Triggered when tick is recevived
func onTick(tick kiteticker.Tick) {
func onTick(tick kitemodels.Tick) {
fmt.Println("Tick: ", tick)
}

Expand Down Expand Up @@ -139,23 +154,28 @@ func main() {
}
```

# Examples
## Examples

Check [examples folder](https://github.com/zerodhatech/gokiteconnect/tree/master/examples) for more examples.
Check [examples folder](https://github.com/zerodha/gokiteconnect/tree/master/examples) for more examples.

You can run the following after updating the API Keys in the examples:

```bash
go run examples/connect/basic/connect.go
```

## Run unit tests
## Development

#### Fetch mock responses for testcases

This needs to be run initially

```
go test -v
git submodule update --init --recursive
```

## Changelog

[Check CHANGELOG.md](CHANGELOG.md)
#### Run unit tests

```
go test -v
```
Loading