upstox-rust-sdk

Crates.ioupstox-rust-sdk
lib.rsupstox-rust-sdk
version0.2.1
sourcesrc
created_at2024-07-05 20:00:20.775469
updated_at2024-11-30 21:45:47.516739
descriptionSDK to access Upstox's Uplink v2 APIs programmatically
homepage
repositoryhttps://github.com/Aviral-Omar/upstox-rust-sdk
max_upload_size
id1293147
size168,877
Aviral Omar (Aviral-Omar)

documentation

README

Upstox Rust SDK for API v2

Introduction

A Rust client for communicating with the Upstox API.

Upstox API is a set of rest APIs that provide data required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio, stream live market data (using Websocket), and a lot more with this crate.

  • API version: v2

Environment Variables

These environment variables are used optionally in the SDK depending on the features to be used.

  • EMAIL_ID: Email used for Upstox account like "abc@example.com" (Only needed when automating login).

  • GOOGLE_AUTHORIZATION_CODE: Authorization code obtained upon Google OAuth 2.0 Authentication which expires in 1 hr. Provide newly fetched value only when manual login page is needed to be skipped (Only needed when automating fetching OTP and using Gmail).

  • GOOGLE_CLIENT_ID: Google Client ID for Google Gmail API access (Only needed when automating fetching OTP and using Gmail).

  • GOOGLE_CLIENT_SECRET: Google Client Secret for Google Gmail API access (Only needed when automating fetching OTP and using Gmail).

  • MOBILE_NUMBER: Mobile number used for Upstox account (Only needed when automating login).

  • LOGIN_PIN: Login PIN for Upstox account (Only needed when automating login).

  • REDIRECT_PORT: The local port used for redirection for both Upstox API and Gmail API like 8080. Redirect URL provided to both Upstox and Google must be "http://127.0.0.1:$REDIRECT_PORT" if login is needed for authorized endpoint access.

  • UPLINK_API_KEY: Upstox API Key. Required for authorized API access (Generate Here).

  • UPLINK_API_SECRET: Upstox API Secret. Required for authorized API access (Generate Here).

  • WEBDRIVER_SOCKET: The local socket on which chromedriver or geckodriver is running. They run by default on "http://127.0.0.1:4444" (Only needed when automating login).

Examples

  • login-usage: Example on using login functionality to get access token, automating login, fetching OTP automatically, scheduling automatic re-login.
  • fetch-instruments: Example on fetching available instruments on startup and refreshing them daily.
  • ws-usage: Example on using websockets and passing callbacks to handle websocket data and handling app exit when using websockets.
  • api-usage: Example on using Upstox's REST API endpoints via the ApiClient.

License

Licensed under MPL 2.0

Contact

Reach out by mailing me at aviralomar0301@gmail.com

Commit count: 53

cargo fmt