|
1 | 1 | from firstrade import account, order, symbols |
2 | 2 |
|
3 | 3 | # Create a session |
4 | | -ft_ss = account.FTSession(username="", password="", email = "", profile_path="") |
| 4 | +ft_ss = account.FTSession(username="", password="", email="", profile_path="") |
5 | 5 | need_code = ft_ss.login() |
6 | 6 | if need_code: |
7 | 7 | code = input("Please enter the pin sent to your email/phone: ") |
|
58 | 58 | history = ft_accounts.get_account_history( |
59 | 59 | account=ft_accounts.account_numbers[0], |
60 | 60 | date_range="cust", |
61 | | - custom_range=["2024-01-01", "2024-06-30"] |
| 61 | + custom_range=["2024-01-01", "2024-06-30"], |
62 | 62 | ) |
63 | 63 |
|
64 | 64 | for item in history["items"]: |
65 | | - print(f"Transaction: {item['symbol']} on {item['report_date']} for {item['amount']}.") |
| 65 | + print( |
| 66 | + f"Transaction: {item['symbol']} on {item['report_date']} for {item['amount']}." |
| 67 | + ) |
66 | 68 |
|
67 | 69 |
|
68 | 70 | # Create an order object. |
|
92 | 94 | # Cancel placed order |
93 | 95 | # cancel = ft_accounts.cancel_order(order_conf['result']["order_id"]) |
94 | 96 | # if cancel["result"]["result"] == "success": |
95 | | - # print("Order cancelled successfully.") |
| 97 | +# print("Order cancelled successfully.") |
96 | 98 | # print(cancel) |
97 | 99 |
|
98 | 100 | # Check orders |
99 | 101 | recent_orders = ft_accounts.get_orders(ft_accounts.account_numbers[0]) |
100 | 102 | print(recent_orders) |
101 | 103 |
|
102 | | -#Get option dates |
| 104 | +# Get option dates |
103 | 105 | option_first = symbols.OptionQuote(ft_ss, "INTC") |
104 | 106 | for item in option_first.option_dates["items"]: |
105 | | - print(f"Expiration Date: {item['exp_date']} Days Left: {item['day_left']} Expiration Type: {item['exp_type']}") |
| 107 | + print( |
| 108 | + f"Expiration Date: {item['exp_date']} Days Left: {item['day_left']} Expiration Type: {item['exp_type']}" |
| 109 | + ) |
106 | 110 |
|
107 | 111 | # Get option quote |
108 | | -option_quote = option_first.get_option_quote("INTC", option_first.option_dates["items"][0]["exp_date"]) |
| 112 | +option_quote = option_first.get_option_quote( |
| 113 | + "INTC", option_first.option_dates["items"][0]["exp_date"] |
| 114 | +) |
109 | 115 | print(option_quote) |
110 | 116 |
|
111 | 117 | # Get option greeks |
112 | | -option_greeks = option_first.get_greek_options("INTC", option_first.option_dates["items"][0]["exp_date"]) |
| 118 | +option_greeks = option_first.get_greek_options( |
| 119 | + "INTC", option_first.option_dates["items"][0]["exp_date"] |
| 120 | +) |
113 | 121 | print(option_greeks) |
114 | 122 |
|
115 | | -print(f"Placing dry option order for {option_quote['items'][0]['opt_symbol']} with a price of {option_quote['items'][0]['ask']}.") |
| 123 | +print( |
| 124 | + f"Placing dry option order for {option_quote['items'][0]['opt_symbol']} with a price of {option_quote['items'][0]['ask']}." |
| 125 | +) |
116 | 126 | print("Symbol readable ticker 'INTC'") |
117 | 127 |
|
118 | 128 | # Place dry option order |
|
0 commit comments