Coder Social home page Coder Social logo

akshay-rakheja / trading-algos Goto Github PK

View Code? Open in Web Editor NEW
22.0 3.0 11.0 1.87 MB

Monorepo for trading algorithms

Python 71.11% Solidity 28.89%
algo-trading algo-trading-strategies alpaca-markets bollinger-bands rsi trading-bot trading-strategies algorithmic-trading cryptocurrency scalping

trading-algos's Introduction

trading-algos's People

Contributors

akshay-rakheja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

trading-algos's Issues

Second Sale and Forward Not Working

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"}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.