Skip to content

Commit a97feb8

Browse files
committed
Version 1.5.0 last adjustments
1 parent 7abcb68 commit a97feb8

File tree

4 files changed

+125
-53
lines changed

4 files changed

+125
-53
lines changed

README.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ <h3 id="deprecated-docker-image">(Deprecated) Docker Image:</h3>
740740
</ul></li>
741741
<li>Step 03:
742742
<ul>
743-
<li>Download <code>shift-python_x.x.x_docker.zip</code>, the Docker Compose package from our <a href="https://github.com/hanlonlab/shift-python/releases">GitHub Release Page</a>.</li>
743+
<li>Download <code>shift_python-x.x.x-docker.zip</code>, the Docker Compose package from our <a href="https://github.com/hanlonlab/shift-python/releases">GitHub Release Page</a>.</li>
744744
<li>Unzip the downloaded file to somewhere you like.</li>
745745
<li>Access a terminal window on your computer. You may require admin privileges:
746746
<ul>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ cd /mnt/c/Users/USERNAME/Desktop
6868
- NOTE: In some cases, you may need to enable virtualization on your computers.
6969

7070
- Step 03:
71-
- Download `shift-python_x.x.x_docker.zip`, the Docker Compose package from our [GitHub Release Page](https://github.com/hanlonlab/shift-python/releases).
71+
- Download `shift_python-x.x.x-docker.zip`, the Docker Compose package from our [GitHub Release Page](https://github.com/hanlonlab/shift-python/releases).
7272
- Unzip the downloaded file to somewhere you like.
7373
- Access a terminal window on your computer. You may require admin privileges:
7474
- For macOS, Terminal.app.

release/docker/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ MAINTAINER Thiago W. Alves ([email protected])
88
ENV TZ=America/New_York
99
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
1010

11+
# Add conda to PATH
12+
ENV PATH /opt/conda/bin:$PATH
13+
1114
# Update all conda packages
1215
RUN conda update --all -y
1316

@@ -16,7 +19,7 @@ RUN conda install black
1619
RUN conda install keras
1720

1821
# Install shift-python
19-
RUN wget -qO- https://github.com/hanlonlab/shift-python/releases/download/v1.5.0/shift-python_1.5.0_conda_linux.zip | bsdtar -xvf- && \
22+
RUN wget -qO- https://github.com/hanlonlab/shift-python/releases/download/v1.5.0/shift_python-1.5.0-conda_linux.zip | bsdtar -xvf- && \
2023
cd shift* && \
2124
conda install *.tar.bz2
2225

release/docker/notebooks/demo.ipynb

Lines changed: 119 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
"metadata": {},
77
"outputs": [],
88
"source": [
9-
"import shift\n",
109
"import sys\n",
11-
"import time"
10+
"import time\n",
11+
"\n",
12+
"import shift"
1213
]
1314
},
1415
{
@@ -38,7 +39,7 @@
3839
"outputs": [],
3940
"source": [
4041
"# subscribe to all available order books\n",
41-
"trader.subAllOrderBook()"
42+
"trader.sub_all_order_book()"
4243
]
4344
},
4445
{
@@ -49,7 +50,7 @@
4950
"source": [
5051
"# submit a limit buy order by indicating order type, symbol, size, and limit price.\n",
5152
"limit_buy = shift.Order(shift.Order.LIMIT_BUY, \"AAPL\", 1, 10.00)\n",
52-
"trader.submitOrder(limit_buy)"
53+
"trader.submit_order(limit_buy)"
5354
]
5455
},
5556
{
@@ -60,10 +61,10 @@
6061
"source": [
6162
"# submit 2 limit buy orders by indicating order type, symbol, size, and limit price.\n",
6263
"aapl_limit_buy = shift.Order(shift.Order.LIMIT_BUY, \"AAPL\", 10, 10.00)\n",
63-
"trader.submitOrder(aapl_limit_buy)\n",
64+
"trader.submit_order(aapl_limit_buy)\n",
6465
"\n",
6566
"xom_limit_buy = shift.Order(shift.Order.LIMIT_BUY, \"XOM\", 10, 10.00)\n",
66-
"trader.submitOrder(xom_limit_buy)"
67+
"trader.submit_order(xom_limit_buy)"
6768
]
6869
},
6970
{
@@ -75,9 +76,11 @@
7576
"# print the local bid order book for AAPL\n",
7677
"print(\"AAPL:\")\n",
7778
"print(\" Price\\t\\tSize\\t Dest\\t\\tTime\")\n",
78-
"for order in trader.getOrderBook(\"AAPL\", shift.OrderBookType.LOCAL_BID):\n",
79-
" print(\"%7.2f\\t\\t%4d\\t%6s\\t\\t%19s\" %\n",
80-
" (order.price, order.size, order.destination, order.time))"
79+
"for order in trader.get_order_book(\"AAPL\", shift.OrderBookType.LOCAL_BID):\n",
80+
" print(\n",
81+
" \"%7.2f\\t\\t%4d\\t%6s\\t\\t%19s\"\n",
82+
" % (order.price, order.size, order.destination, order.time)\n",
83+
" )"
8184
]
8285
},
8386
{
@@ -89,9 +92,11 @@
8992
"# print the local bid order book for XOM\n",
9093
"print(\"XOM:\")\n",
9194
"print(\" Price\\t\\tSize\\t Dest\\t\\tTime\")\n",
92-
"for order in trader.getOrderBook(\"XOM\", shift.OrderBookType.LOCAL_BID):\n",
93-
" print(\"%7.2f\\t\\t%4d\\t%6s\\t\\t%19s\" %\n",
94-
" (order.price, order.size, order.destination, order.time))"
95+
"for order in trader.get_order_book(\"XOM\", shift.OrderBookType.LOCAL_BID):\n",
96+
" print(\n",
97+
" \"%7.2f\\t\\t%4d\\t%6s\\t\\t%19s\"\n",
98+
" % (order.price, order.size, order.destination, order.time)\n",
99+
" )"
95100
]
96101
},
97102
{
@@ -101,10 +106,21 @@
101106
"outputs": [],
102107
"source": [
103108
"# print all current waiting orders information\n",
104-
"print(\"Symbol\\t\\t\\t Type\\t Price\\t\\tSize\\tID\\t\\t\\t\\t\\tTimestamp\")\n",
105-
"for order in trader.getWaitingList():\n",
106-
" print(\"%6s\\t%21s\\t%7.2f\\t\\t%4d\\t%36s\\t%26s\" %\n",
107-
" (order.symbol, order.type, order.price, order.size, order.id, order.timestamp))"
109+
"print(\n",
110+
" \"Symbol\\t\\t Type\\t Price\\t\\tSize\\t Executed\\t\\t\\t Status\"\n",
111+
")\n",
112+
"for order in trader.get_waiting_list():\n",
113+
" print(\n",
114+
" \"%6s\\t%16s\\t%7.2f\\t\\t%4d\\t\\t%4d\\t%23s\"\n",
115+
" % (\n",
116+
" order.symbol,\n",
117+
" order.type,\n",
118+
" price,\n",
119+
" order.size,\n",
120+
" order.executed_size,\n",
121+
" order.status,\n",
122+
" )\n",
123+
" )"
108124
]
109125
},
110126
{
@@ -114,7 +130,7 @@
114130
"outputs": [],
115131
"source": [
116132
"# cancel all pending orders\n",
117-
"trader.cancelAllPendingOrders()"
133+
"trader.cancel_all_pending_orders()"
118134
]
119135
},
120136
{
@@ -124,10 +140,21 @@
124140
"outputs": [],
125141
"source": [
126142
"# print all current waiting orders information\n",
127-
"print(\"Symbol\\t\\t\\t Type\\t Price\\t\\tSize\\tID\\t\\t\\t\\t\\tTimestamp\")\n",
128-
"for order in trader.getWaitingList():\n",
129-
" print(\"%6s\\t%21s\\t%7.2f\\t\\t%4d\\t%36s\\t%26s\" %\n",
130-
" (order.symbol, order.type, order.price, order.size, order.id, order.timestamp))"
143+
"print(\n",
144+
" \"Symbol\\t\\t Type\\t Price\\t\\tSize\\t Executed\\t\\t\\t Status\"\n",
145+
")\n",
146+
"for order in trader.get_waiting_list():\n",
147+
" print(\n",
148+
" \"%6s\\t%16s\\t%7.2f\\t\\t%4d\\t\\t%4d\\t%23s\"\n",
149+
" % (\n",
150+
" order.symbol,\n",
151+
" order.type,\n",
152+
" price,\n",
153+
" order.size,\n",
154+
" order.executed_size,\n",
155+
" order.status,\n",
156+
" )\n",
157+
" )"
131158
]
132159
},
133160
{
@@ -138,10 +165,10 @@
138165
"source": [
139166
"# submit 2 market buy orders\n",
140167
"aapl_market_buy = shift.Order(shift.Order.MARKET_BUY, \"AAPL\", 1)\n",
141-
"trader.submitOrder(aapl_market_buy)\n",
168+
"trader.submit_order(aapl_market_buy)\n",
142169
"\n",
143170
"xom_market_buy = shift.Order(shift.Order.MARKET_BUY, \"XOM\", 1)\n",
144-
"trader.submitOrder(xom_market_buy)"
171+
"trader.submit_order(xom_market_buy)"
145172
]
146173
},
147174
{
@@ -152,10 +179,15 @@
152179
"source": [
153180
"# print current portfolio summary information\n",
154181
"print(\"Buying Power\\tTotal Shares\\tTotal P&L\\tTimestamp\")\n",
155-
"print(\"%12.2f\\t%12d\\t%9.2f\\t%26s\" % (trader.getPortfolioSummary().getTotalBP(),\n",
156-
" trader.getPortfolioSummary().getTotalShares(),\n",
157-
" trader.getPortfolioSummary().getTotalRealizedPL(),\n",
158-
" trader.getPortfolioSummary().getTimestamp()))"
182+
"print(\n",
183+
" \"%12.2f\\t%12d\\t%9.2f\\t%26s\"\n",
184+
" % (\n",
185+
" trader.get_portfolio_summary().get_total_bp(),\n",
186+
" trader.get_portfolio_summary().get_total_shares(),\n",
187+
" trader.get_portfolio_summary().get_total_realized_pl(),\n",
188+
" trader.get_portfolio_summary().get_timestamp(),\n",
189+
" )\n",
190+
")"
159191
]
160192
},
161193
{
@@ -165,10 +197,18 @@
165197
"outputs": [],
166198
"source": [
167199
"# print current portfolio items information\n",
168-
"print(\"Symbol\\t\\tShares\\t Price\\t P&L\\t\\tTimestamp\")\n",
169-
"for item in trader.getPortfolioItems().values():\n",
170-
" print(\"%6s\\t\\t%6d\\t%9.2f\\t%7.2f\\t\\t%26s\" %\n",
171-
" (item.getSymbol(), item.getShares(), item.getPrice(), item.getRealizedPL(), item.getTimestamp()))"
200+
"print(\"Symbol\\t\\tShares\\t Price\\t P&L\\tTimestamp\")\n",
201+
"for item in trader.get_portfolio_items().values():\n",
202+
" print(\n",
203+
" \"%6s\\t\\t%6d\\t%9.2f\\t%9.2f\\t%26s\"\n",
204+
" % (\n",
205+
" item.get_symbol(),\n",
206+
" item.get_shares(),\n",
207+
" item.get_price(),\n",
208+
" item.get_realized_pl(),\n",
209+
" item.get_timestamp(),\n",
210+
" )\n",
211+
" )"
172212
]
173213
},
174214
{
@@ -179,10 +219,10 @@
179219
"source": [
180220
"# submit 2 market sell orders\n",
181221
"aapl_market_sell = shift.Order(shift.Order.MARKET_SELL, \"AAPL\", 1)\n",
182-
"trader.submitOrder(aapl_market_sell)\n",
222+
"trader.submit_order(aapl_market_sell)\n",
183223
"\n",
184224
"xom_market_sell = shift.Order(shift.Order.MARKET_SELL, \"XOM\", 1)\n",
185-
"trader.submitOrder(xom_market_sell)"
225+
"trader.submit_order(xom_market_sell)"
186226
]
187227
},
188228
{
@@ -193,10 +233,15 @@
193233
"source": [
194234
"# print current portfolio summary information\n",
195235
"print(\"Buying Power\\tTotal Shares\\tTotal P&L\\tTimestamp\")\n",
196-
"print(\"%12.2f\\t%12d\\t%9.2f\\t%26s\" % (trader.getPortfolioSummary().getTotalBP(),\n",
197-
" trader.getPortfolioSummary().getTotalShares(),\n",
198-
" trader.getPortfolioSummary().getTotalRealizedPL(),\n",
199-
" trader.getPortfolioSummary().getTimestamp()))"
236+
"print(\n",
237+
" \"%12.2f\\t%12d\\t%9.2f\\t%26s\"\n",
238+
" % (\n",
239+
" trader.get_portfolio_summary().get_total_bp(),\n",
240+
" trader.get_portfolio_summary().get_total_shares(),\n",
241+
" trader.get_portfolio_summary().get_total_realized_pl(),\n",
242+
" trader.get_portfolio_summary().get_timestamp(),\n",
243+
" )\n",
244+
")"
200245
]
201246
},
202247
{
@@ -206,10 +251,18 @@
206251
"outputs": [],
207252
"source": [
208253
"# print current portfolio items information\n",
209-
"print(\"Symbol\\t\\tShares\\t Price\\t P&L\\t\\tTimestamp\")\n",
210-
"for item in trader.getPortfolioItems().values():\n",
211-
" print(\"%6s\\t\\t%6d\\t%9.2f\\t%7.2f\\t\\t%26s\" %\n",
212-
" (item.getSymbol(), item.getShares(), item.getPrice(), item.getRealizedPL(), item.getTimestamp()))"
254+
"print(\"Symbol\\t\\tShares\\t Price\\t P&L\\tTimestamp\")\n",
255+
"for item in trader.get_portfolio_items().values():\n",
256+
" print(\n",
257+
" \"%6s\\t\\t%6d\\t%9.2f\\t%9.2f\\t%26s\"\n",
258+
" % (\n",
259+
" item.get_symbol(),\n",
260+
" item.get_shares(),\n",
261+
" item.get_price(),\n",
262+
" item.get_realized_pl(),\n",
263+
" item.get_timestamp(),\n",
264+
" )\n",
265+
" )"
213266
]
214267
},
215268
{
@@ -219,10 +272,25 @@
219272
"outputs": [],
220273
"source": [
221274
"# print all submitted orders information\n",
222-
"print(\"Symbol\\t\\t\\t Type\\t Price\\t\\tSize\\tID\\t\\t\\t\\t\\tTimestamp\")\n",
223-
"for order in trader.getSubmittedOrders():\n",
224-
" print(\"%6s\\t%21s\\t%7.2f\\t\\t%4d\\t%36s\\t%26s\" %\n",
225-
" (order.symbol, order.type, order.price, order.size, order.id, order.timestamp))"
275+
"print(\n",
276+
" \"Symbol\\t\\t Type\\t Price\\t\\tSize\\t Executed\\t\\t\\t Status\"\n",
277+
")\n",
278+
"for order in trader.get_submitted_orders():\n",
279+
" if order.status == shift.Order.Status.FILLED:\n",
280+
" price = order.executed_price\n",
281+
" else:\n",
282+
" price = order.price\n",
283+
" print(\n",
284+
" \"%6s\\t%16s\\t%7.2f\\t\\t%4d\\t\\t%4d\\t%23s\"\n",
285+
" % (\n",
286+
" order.symbol,\n",
287+
" order.type,\n",
288+
" price,\n",
289+
" order.size,\n",
290+
" order.executed_size,\n",
291+
" order.status,\n",
292+
" )\n",
293+
" )"
226294
]
227295
},
228296
{
@@ -232,11 +300,12 @@
232300
"outputs": [],
233301
"source": [
234302
"# print the global bid order book for AAPL\n",
235-
"print(\"AAPL:\")\n",
236303
"print(\" Price\\t\\tSize\\t Dest\\t\\tTime\")\n",
237-
"for order in trader.getOrderBook(\"AAPL\", shift.OrderBookType.GLOBAL_BID, 5):\n",
238-
" print(\"%7.2f\\t\\t%4d\\t%6s\\t\\t%19s\" %\n",
239-
" (order.price, order.size, order.destination, order.time))"
304+
"for order in trader.get_order_book(\"AAPL\", shift.OrderBookType.GLOBAL_BID, 5):\n",
305+
" print(\n",
306+
" \"%7.2f\\t\\t%4d\\t%6s\\t\\t%19s\"\n",
307+
" % (order.price, order.size, order.destination, order.time)\n",
308+
" )"
240309
]
241310
},
242311
{
@@ -273,7 +342,7 @@
273342
"name": "python",
274343
"nbconvert_exporter": "python",
275344
"pygments_lexer": "ipython3",
276-
"version": "3.7.2"
345+
"version": "3.7.4"
277346
}
278347
},
279348
"nbformat": 4,

0 commit comments

Comments
 (0)