Skip to content

Rust crate to connect with Zerodha's KiteConnect API

License

Notifications You must be signed in to change notification settings

saxena-dev/manja

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

manja

Manja (IPA: /maːŋdʒʱaː/) n.: A type of abrasive string utilized primarily for flying fighter kites, especially prevalent in South Asian countries. It is crafted by coating cotton string with powdered glass or a similar abrasive substance.

This crate provides a Rust client library for Zerodha's Kite Connect trading APIs (a set of REST-like HTTP APIs).

manja Features

manja strives to improve the developer experience by providing better support in IDEs with features like auto-completion, type-inference, and inline documentation.

  • Type safe

    • Compile-time Type Checking: type safety ensures that errors related to type mismatches are caught during compilation rather than at runtime.
    • Consistent Data Models: manja uses strongly typed data models that match Kite Connect API's expected inputs and outputs.
    • Enhanced Security: by ensuring that only valid data types are sent to and received from the API, the risk of data-related vulnerabilities is reduced.
    • Automatic Serialization/Deserialization: manja handles the serialization (converting data structures to JSON) and deserialization (converting JSON responses back to data structures) automatically and correctly. This ensures that the data sent to and received from Kite Connect API adheres to the expected types.
  • Asynchronous: built on the performant tokio async-runtime, manja delivers unmatched performance, ensuring your applications run faster and more efficiently than ever before.

    • Resource Efficiency: maximize the use of your system's resources. manja's asynchronous nature allows for optimal resource management, reducing overhead and improving overall performance.
    • Concurrent Task Handling: manage multiple tasks simultaneously without sacrificing performance or reliability.
    • Improved latency: experience reduced latency and faster response times, ensuring your applications are always responsive.
  • Distributed Logging: stay ahead of issues with real-time distributed logging using the tracing crate.

    • Streamline Development: facilitate smoother development cycles with better debugging and faster issue resolution.
    • Reduce Downtime: with real-time insights and quick access to logs, identify and resolve issues faster, minimizing downtime.
    • Enhance User Experience: quickly address errors and performance bottlenecks to provide a better experience for your users.
  • WebSocket support for streaming binary market data.

    • Auto-reconnect Mechanism: manja provides a reliable async WebSocket client with a configurable exponential backoff retry mechanism.
  • WebDriver integration for retrieving request token from the redirect URL after successfully authenticating with the Kite platform.

Kite Connect 3.0 API: Supported Endpoints

  • User

    • POST /session/token Authenticate and obtain the access_token after the login flow
    • GET /user/profile Retrieve the user profile
    • GET /user/margins/:segment Retrieve detailed funds and margin information
    • DELETE /session/token Logout and invalidate the API session and access_token
  • Orders

    • POST /orders/:variety Place an order of a particular variety
    • PUT /orders/:variety/:order_id Modify an open or pending order
    • DELETE /orders/:variety/:order_id Cancel an open or pending order
    • GET /orders Retrieve the list of all orders (open and executed) for the day
    • GET /orders/:order_id Retrieve the history of a given order
    • GET /trades Retrieve the list of all executed trades for the day
    • GET /orders/:order_id/trades Retrieve the trades generated by an order
  • GTT - Good Till Triggered orders

    • POST /gtt/triggers Places a GTT
    • GET /gtt/triggers Retrieve a list of all GTTs visible in GTT order book
    • GET /gtt/triggers/:id Retrieve an individual trigger
    • PUT /gtt/triggers/:id Modify an active GTT
    • DELETE /gtt/triggres/:id Delete an active GTT
  • Portfolio

    • GET /portfolio/holdings Retrieve the list of long term equity holdings
    • GET /portfolio/positions Retrieve the list of short term positions
    • PUT /portfolio/positions Convert the margin product of an open position
    • GET /portfolio/holdings/auctions Retrieve the list of auctions that are currently being held
    • POST /portfolio/holdings/authorise Place an electronic authorisation to debit shares and settle the transactions
  • Market quotes and instruments

    • GET /instruments Retrieve the CSV dump of all tradable instruments
    • GET /instruments/:exchange Retrieve the CSV dump of instruments in the particular exchange
    • GET /quote Retrieve the full market quotes for one or more instruments
    • GET /quote/ohlc Retrieve OHLC quotes for one or more instruments
    • GET /quote/ltp Retrieve LTP quotes for one or more instruments
  • Historical candle data

    • GET /instruments/historical/:instrument_token/:interval Retrieve historical candle records for a given instrument
  • Mutual funds

    • POST /mf/orders Place a buy or sell order
    • DELETE /mf/orders/:order_id Cancel an open or pending order
    • GET /mf/orders Retrieve the list of all orders (open and executed) over the last 7 days
    • GET /mf/orders/:order_id Retrieve an individual order
    • POST /mf/sips Place a SIP order
    • PUT /mf/sips/:order_id Modify an open SIP order
    • DELETE /mf/sips/:order_id Cancel an open SIP order
    • GET /mf/sips Retrieve the list of all open SIP orders
    • GET /mf/sips/:order_id Retrieve an individual SIP order
    • GET /mf/holdings Retrieve the list of mutual fund holdings available in the DEMAT
    • GET /mf/instruments Retrieve the master list of all mutual funds available on the platform
  • Margin calculation

    • POST /margins/orders Calculates margins for each order considering the existing positions and open orders
    • POST /margins/basket Calculates margins for spread orders
    • POST /charges/orders Calculates order-wise charges for orderbook
  • WebSocket streaming

    • Auto-reconnect mechanism with subscription

Disclaimer

Important Notice:

  • The manja crate is currently in development and should be considered unstable. The API is subject to change without notice, and breaking changes are likely to occur.

  • The software is provided "as-is" without any warranties, express or implied. The author and contributors of this SDK do not take responsibility for any financial losses, damages, or other issues that may arise from the use of this project.

About

Rust crate to connect with Zerodha's KiteConnect API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages