uberdeveloper / omspy Goto Github PK
View Code? Open in Web Editor NEWImproved Order Management System for stock trading
License: MIT License
Improved Order Management System for stock trading
License: MIT License
Order function by default not picking up the local timezone, instead it defaults to UTC
when orders are updated, rejected and completed orders must be skipped
and timestamp should not be updated to the latest timestamp
##feature request##
you can differentiate between buy trade and sell trade like below
'''buy trade'''
buy / sell
'''sell trade'''
short / cover
timestamp should not be changed if an order is retrieved from database or populated.
Don't overwrite timestamp if it already exits
Any errors relating to database should be handled in save_to_db
function.
This would be handling sqlite3 errors only.
Line 214 in 33f2fbc
This would not handle database not exist or wrong type errors
lock
accepts seconds in float as input.
This should be converted to seconds and microseconds before passing to pendulum
When creating a peg order from an existing order, orders have different id in memory.
I think a copy of the object is created in memory when an existing order is added to
any type of peg order. Using the same order object everywhere would be better for updates.
Need to discuss more about the pros and cons of this approach.
Pending quantity to be updated when an order is updated.
It could be updated based on status or comparing filled quantity with total quantity
Raise a validation error if the timer and timezone have different values
Use the retries
attribute to manage retries on execution
Line 90 in 33f2fbc
When an order is retried, add it to the retries attribute and when the max retries is hit, cancel the order.
An order would be retried if we don't get any response from the broker.
Count the number of modifications made.
Line 219 in 33f2fbc
This is helpful for taking action after some limit is hit since a lot of brokers has a cap on the number of modifications
Change the PegSequential
class to add lock directly to orders.
the expiry time of an order is calculated at the time of order generation
using the timestamp field but the timestamp gets updated when an order
update is run. The initial timestamp should not change
refactor common code for add_order
and add
function into a single function
since both the functions do almost the same thing
file: models.py
class Quote(BaseModel):
price: float
quantity: int
orders: Optional[int] = None
unless I am missing something (please clarify):
Quote should not have orders within - if this field represents participating order's id - the field should be an optional list of int instead
restrict modify method to only few fields, since modification to all fields are not supported by brokers
example fields to restrict: symbol, side etc
For canceled and rejected orders, peg orders should stop trying
All fields with timestamp data type should have the same timezone and should be initialized at the start
Line 70 in 33f2fbc
Create an add method that directly adds order instead of creating them
Line 333 in 33f2fbc
If an order is added using the add
method, add an id automatically if the order id is None
All timestamp columns in Order
should be updated with a uniform format
Automatically infer order type from arguments if order type not given explicitly
Raise an error if prices are not in accordance with the order types
Zerodha broker already provides data as a list and not a dictionary.
So no need to extract the 'data' key
omspy/omspy/brokers/zerodha.py
Line 167 in bf270ff
File: tests/brokers/test_finvasia.py
@pytest.fixture
def mod():
with open("omspy/brokers/finvasia.yaml") as f:
return yaml.safe_load(f)
file finvasia.yaml is not found anywhere in repo
create a save method on CompoundOrder class to save all orders
Shows up typing error when mypy is run on the base folder
Line 173 in 7d57f85
omspy/base.py:258: error: Argument 1 to "order_cancel" of "Broker" has incompatible type "**Dict[Any, Optional[Any]]"; expected "str"
omspy/order.py:173: error: Argument 1 to "order_place" of "Broker" has incompatible type "**Dict[str, object]"; expected "Broker"
omspy/order.py:173: error: Argument 1 to "order_place" of "Broker" has incompatible type "**Dict[str, object]"; expected "str"
omspy/order.py:173: error: Argument 1 to "order_place" of "Broker" has incompatible type "**Dict[str, object]"; expected "int"
omspy/order.py:193: error: Argument 1 to "order_modify" of "Broker" has incompatible type "**Dict[str, Union[str, None, float]]"; expected "str"
omspy/order.py:199: error: Argument "order_id" to "order_cancel" of "Broker" has incompatible type "Optional[str]"; expected "str"
omspy/order.py:237: error: Too many arguments for "Order"
randrange
function returns error when start and stop numbers are the same.
This happens when the 2 numbers selected are the same.
If the numbers are same, the stop must be incremented by one
Peg orders should pass respective order arguments when executing for the first time
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.