This repo conatins the following trading strategies to trade on Alpaca:
akshay-rakheja / trading-algos Goto Github PK
View Code? Open in Web Editor NEWMonorepo for trading algorithms
Monorepo for trading algorithms
This repo conatins the following trading strategies to trade on Alpaca:
When running the program lstm.py, there is a bug. After an initial buy and subsequent sale, current_position is not updated after a sale. It remains 4.9875ETH although there is actually 0ETH in our alpaca portfolio. Therefore another buy cannot be completed because current_position > 0.01ETH. Also if predicted_price <= current_price, a sale is activated because current_position is not updated and is > 0.01ETH. However since the qty returned from the API call is actually 0.00 an error is thrown.
Epoch 20/20
29/29 [==============================] - 3s 112ms/step - loss: 0.0077
2022-10-30 01:55:44,133 - main - INFO - Extracting data to predict on
2022-10-30 01:55:44,133 - main - INFO - Predicting Price
1/1 [==============================] - 1s 1s/step
2022-10-30 01:55:45,271 - main - INFO - Predicted Price is 1623.173828983307
2022-10-30 01:55:45,518 - main - INFO - Current Price is: 1632.7
2022-10-30 01:55:45,519 - main - INFO - Current Position is: 4.9875
2022-10-30 01:55:45,522 - main - INFO - Placing Sell Order
2022-10-30 01:55:45,577 - main - ERROR - There was an issue posting order to Alpaca: {"available":"0","balance":"0","code":40310000,"message":"insufficient balance for ETH (requested: 4.9875, available: 0)","symbol":"USD"}
Traceback (most recent call last):
File "C:\Users\range\anaconda3\envs\dev\envs\tradingenv\lib\site-packages\alpaca\common\rest.py", line 187, in _one_request
response.raise_for_status()
File "C:\Users\range\anaconda3\envs\dev\envs\tradingenv\lib\site-packages\requests\models.py", line 960, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://paper-api.alpaca.markets/v2/orders
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "lstm.py", line 241, in post_alpaca_order
order_data=market_order_data
File "C:\Users\range\anaconda3\envs\dev\envs\tradingenv\lib\site-packages\alpaca\trading\client.py", line 89, in submit_order
response = self.post("/orders", data)
File "C:\Users\range\anaconda3\envs\dev\envs\tradingenv\lib\site-packages\alpaca\common\rest.py", line 225, in post
return self._request("POST", path, data)
File "C:\Users\range\anaconda3\envs\dev\envs\tradingenv\lib\site-packages\alpaca\common\rest.py", line 126, in _request
return self._one_request(method, url, opts, retry)
File "C:\Users\range\anaconda3\envs\dev\envs\tradingenv\lib\site-packages\alpaca\common\rest.py", line 196, in _one_request
raise APIError(error, http_error)
alpaca.common.exceptions.APIError: {"available":"0","balance":"0","code":40310000,"message":"insufficient balance for ETH (requested: 4.9875, available: 0)","symbol":"USD"}
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.