|
13 | 13 | Stock |
14 | 14 | ) |
15 | 15 |
|
| 16 | +print("----- running {}".format(__file__)) |
| 17 | + |
16 | 18 | # |
17 | 19 | # get the authentication configs |
18 | 20 | # |
|
35 | 37 | # |
36 | 38 | symbol = "SPY" |
37 | 39 | stock = Stock.fetch(client, symbol) |
38 | | -stock = Stock.mergein_marketdata_list(client, [stock])[0] |
39 | 40 |
|
40 | 41 | oc = OptionChain.fetch(client, stock["id"], symbol) |
41 | 42 | ed = oc['expiration_dates'][10] |
|
53 | 54 | width = 1 |
54 | 55 | put_inner_lte_delta = -0.2 |
55 | 56 | call_inner_lte_delta = 0.1 |
56 | | -ic = IronCondor.generate_by_deltas(ops, |
57 | | - width, put_inner_lte_delta, call_inner_lte_delta) |
58 | | - |
59 | | -direction = "credit" |
60 | | -legs = ic["legs"] |
61 | | -# @TODO create helper methods to handle floating arith and rounding issues |
62 | | -# for now, it works good enough |
63 | | -price_notional = ic["price"] * 100 |
64 | | -price_notional_fourth = price_notional / 4 |
65 | | -price_order = price_notional_fourth / 100 |
66 | | -price = str(price_order) |
67 | | - |
68 | | -quantity = 1 |
69 | | -time_in_force = "gfd" |
70 | | -trigger = "immediate" |
71 | | -order_type = "limit" |
72 | | - |
73 | | -# @TODO create human description of IC |
74 | | -# print("Selling a {} {}/{} Put Spread for {} (notional value = ${})".format( |
75 | | -# symbol, |
76 | | -# vertical["strike_price"].values[0], |
77 | | -# vertical["strike_price_shifted"].values[0], |
78 | | -# price, |
79 | | -# my_bid_price_rounded) |
80 | | -# ) |
81 | | - |
82 | | -oo = OptionOrder.submit(client, direction, legs, price, quantity, time_in_force, trigger, order_type) |
83 | | - |
84 | | -print("Order submitted ... ref_id = {}".format(oo["ref_id"])) |
85 | | - |
| 57 | +# ic = IronCondor.generate_by_deltas(ops,width, put_inner_lte_delta, call_inner_lte_delta) |
| 58 | +# |
| 59 | +# direction = "credit" |
| 60 | +# legs = ic["legs"] |
| 61 | +# # @TODO create helper methods to handle floating arith and rounding issues |
| 62 | +# # for now, it works good enough |
| 63 | +# price_notional = ic["price"] * 100 |
| 64 | +# price_notional_fourth = price_notional / 4 |
| 65 | +# price_order = price_notional_fourth / 100 |
| 66 | +# price = str(price_order) |
| 67 | +# |
| 68 | +# quantity = 1 |
| 69 | +# time_in_force = "gfd" |
| 70 | +# trigger = "immediate" |
| 71 | +# order_type = "limit" |
| 72 | +# |
| 73 | +# # @TODO create human description of IC |
| 74 | +# # print("Selling a {} {}/{} Put Spread for {} (notional value = ${})".format( |
| 75 | +# # symbol, |
| 76 | +# # vertical["strike_price"].values[0], |
| 77 | +# # vertical["strike_price_shifted"].values[0], |
| 78 | +# # price, |
| 79 | +# # my_bid_price_rounded) |
| 80 | +# # ) |
| 81 | +# |
| 82 | +# oo = OptionOrder.submit(client, direction, legs, price, quantity, time_in_force, trigger, order_type) |
86 | 83 | # |
87 | | -# cancel the order |
| 84 | +# print("Order submitted ... ref_id = {}".format(oo["ref_id"])) |
88 | 85 | # |
89 | | -print("Canceling order = {}".format(oo["ref_id"])) |
90 | | -result = OptionOrder.cancel(client, oo['cancel_url']) |
91 | | -print("Order canceled result = {}".format(result)) |
| 86 | +# # |
| 87 | +# # cancel the order |
| 88 | +# # |
| 89 | +# print("Canceling order = {}".format(oo["ref_id"])) |
| 90 | +# result = OptionOrder.cancel(client, oo['cancel_url']) |
| 91 | +# print("Order canceled result = {}".format(result)) |
0 commit comments