Skip to content

Commit

Permalink
Merge pull request #17 from jiak94/main
Browse files Browse the repository at this point in the history
[Feature] Support fractional order
  • Loading branch information
MaxxRK authored Apr 5, 2024
2 parents 7c8cbc8 + ad08a3f commit dbc676b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
46 changes: 28 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
# firstrade-api
A reverse-engineered python API to interact with the Firstrade Trading platform.

This is not an official api! This api's functionality may change at any time.
A reverse-engineered python API to interact with the Firstrade Trading platform.

This api provides a means of buying and selling stocks through Firstrade. It uses the Session class from requests to get authorization cookies. The rest is done with reverse engineered requests to Firstrade's API.
This is not an official api! This api's functionality may change at any time.

---
This api provides a means of buying and selling stocks through Firstrade. It uses the Session class from requests to get authorization cookies. The rest is done with reverse engineered requests to Firstrade's API.

---

## Contribution

I am new to coding and new to open-source. I would love any help and suggestions!

## Setup

Install using pypi:

```
pip install firstrade
```

## Quikstart
The code below will:
- Login and print account info.

The code below will:

- Login and print account info.
- Get a quote for 'INTC' and print out the information
- Place a market order for 'INTC' on the first account in the `account_numbers` list
- Print out the order confirmation
Expand Down Expand Up @@ -72,9 +78,10 @@ ft_order.place_order(
symbol="INTC",
price_type=order.PriceType.MARKET,
order_type=order.OrderType.BUY,
quantity=1,
quantity=1, # number of shares or amount of dollar, depnds on the value of notional
duration=order.Duration.DAY,
dry_run=True,
notional=False, # set to True if quantity above is "dollar"
)
# Print Order data Dict
Expand All @@ -92,21 +99,24 @@ else:
# Delete cookies
ft_ss.delete_cookies()
```

This code is also in test.py

---

## Implemented Features
- [x] Login
- [x] Get Quotes
- [x] Get Account Data
- [x] Place Orders and Receive order confirmation
- [x] Get Currently Held Positions
## Implemented Features

- [x] Login
- [x] Get Quotes
- [x] Get Account Data
- [x] Place Orders and Receive order confirmation
- [x] Get Currently Held Positions

## TO DO
- [ ] Check on placed order status.
- [ ] Cancel placed orders
- [ ] Options
- [ ] Give me some Ideas!

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/O5O6PTOYG)
- [ ] Check on placed order status.
- [ ] Cancel placed orders
- [ ] Options
- [ ] Give me some Ideas!

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/O5O6PTOYG)
2 changes: 2 additions & 0 deletions firstrade/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def place_order(
duration: Duration,
price=0.00,
dry_run=True,
notional=False,
):
"""
Builds and places an order.
Expand Down Expand Up @@ -100,6 +101,7 @@ def place_order(
"submiturl": "/cgi-bin/orderbar",
"orderbar_clordid": "",
"orderbar_accountid": "",
"notional": "yes" if notional else "",
"stockorderpage": "yes",
"submitOrders": "1",
"previewOrders": previewOrders,
Expand Down

0 comments on commit dbc676b

Please sign in to comment.