Skip to main content

A Python library for interacting with OpenAlgo's trading APIs

Project description

OpenAlgo - Python API Client for Automated Trading

About OpenAlgo

OpenAlgo is a self-hosted, Python-based platform designed to automate trading orders efficiently and effortlessly. Developed using the Flask framework and Tailwind CSS, OpenAlgo offers a user-friendly interface and leverages a robust SQLite database for local data management. Whether running on a personal desktop, laptop, or deployed on a server, OpenAlgo provides the flexibility required for various trading setups.

Download OpenAlgo from GitHub to get started with automating your trading strategies today.

Key Features

  • Smart Order Placement: Execute trades swiftly and efficiently with advanced order placement capabilities.
  • Automated Square-off: Utilize one-click and time-based auto square-off functionalities to optimize trading outcomes.
  • Local Data Storage: Ensure maximum privacy and control with your data securely stored on your local device.
  • Interactive UI Interface: Enjoy a seamless trading experience with a clean and intuitive user interface.
  • Comprehensive API Log Management: Analyze and refine your trading strategies with detailed log management.
  • Versatile API Access: Supports local API access, Ngrok based internet access, and hosted API access for flexible connectivity.
  • Data Ownership: Maintain complete ownership of your data, affirming OpenAlgo's commitment to privacy and control.
  • Rapid Execution: Minimize slippage and maximize potential with faster trade execution.
  • Custom Webhook URL: Customize and integrate with your preferred trading applications through webhook URLs.

License

OpenAlgo is licensed under the MIT License. See the LICENSE file for more details.

Documentation

For a detailed understanding of each API's behavior and capabilities, refer to the OpenAlgo REST API Documentation.

Installation

Install from PyPI

pip install openalgo

Install from Source

Clone the OpenAlgo repository and install using setup.py:

git clone https://github.com/yourusername/openalgo.git
cd openalgo
python setup.py install

Getting Started

After installation, import OpenAlgo and initialize the API client with your credentials:

from openalgo.orders import api

# Initialize the API client
my_api = api(api_key="your_api_key")

Creating an API Object

To create an API object, provide your API key, and optionally, the host URL and API version:

my_api = api(api_key="your_api_key_here", host="http://127.0.0.1:5000", version="v1")

Using Object Methods

Utilize the methods by calling them with the necessary parameters. Here are some examples:

Place an Order

response = my_api.placeorder(symbol="RELIANCE-EQ", action="BUY", exchange="NSE", quantity=1)
print(response)

Modify an Order

response = my_api.modifyorder(order_id="12345678", symbol="INFY-EQ", action="SELL", exchange="NSE", product="CNC", quantity=2, price=1500)
print(response)

Cancel an Order

response = my_api.cancelorder(order_id="12345678")
print(response)

Close a Position

response = my_api.closeposition(strategy="MyStrategy")
print(response)

Cancel All Orders

response = my_api.cancelallorder(strategy="MyStrategy")
print(response)

For more detailed usage and additional methods, refer to the OpenAlgo API documentation linked above. Customize this README as necessary to match your library's functionality and usage.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openalgo-1.0.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openalgo-1.0.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file openalgo-1.0.1.tar.gz.

File metadata

  • Download URL: openalgo-1.0.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.11

File hashes

Hashes for openalgo-1.0.1.tar.gz
Algorithm Hash digest
SHA256 705239360e8e15226d648bd9e648b6e638b05a18666c8eaa71ac5cf5e194a399
MD5 80947669451cc0a7838ffe0461e1ac0f
BLAKE2b-256 43de629715957d4f4283942bff9ddc16c522f8c7648ee2b644ee619962baec33

See more details on using hashes here.

File details

Details for the file openalgo-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: openalgo-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.11

File hashes

Hashes for openalgo-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 64d418a973bfa48bb828c8129f9356a35e770e588d843ce9bf5d29bc4b67d404
MD5 0dd11f4511874ab4ee2f0566933dc44e
BLAKE2b-256 d149883d12de0c2d970aaf1f63e5ab7dfc9cdef310812105d1f139d25ab09a8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page