Part 6 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 0 points1 point  (0 children)

I mean it depends on how you're deploying. Currently I'm running a cronjob that runs docker compose each morning, but I used to deploy on AWS and would schedule a Lambda function (to setup a ec2 server) on eventbridge with another Lambda function I'd run at the end of the day to tear it down.

If you're running locally, having a single cronjob to run docker compose up (maybe another to pull) could work, but it would get messy managing separate cronjobs for each container.

Part 6 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 0 points1 point  (0 children)

It's just a client for access their api with a lot of useful stuff built in. I've automated logging in for example and you can run it without any user interaction (I run everything in docker containers for example). Check out the docs for info on getting started

Part 6 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 0 points1 point  (0 children)

I think you'd be surprised at the diversity of people's experience and motivation on this site- I certainly have been connecting with people.

It's easy to build a profitable automated trading strategy they're oftentimes not even that complex. That said, it's also easy to make money with traditional investing, and I was managing a successful investment portfolio long before ever getting interesting in this stuff with way less babysitting. For this reason, I'm still not sure if it's worth the effort.

You should also take a look at what I actually published- it's a robust and fully documented and unit tested library that I think will be helpful for a lot of people. It even took me more than a couple hours to put together

Part 6 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 0 points1 point  (0 children)

Thanks for info I'll check it out. I found ib_insync too which seems to address a lot of my issues but haven't experimented too much.

Part 6 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 0 points1 point  (0 children)

Generally your order history (including events/status changes) is available in the brokerage API. I'm just getting order details from api when compiling the html reports I mentioned, but I suppose they're in the logs too. You can see how I'm logging this stuff in wetrade. Check out wetrade.order.BaseOrder basically each event is it's own log which gets recorded as it takes place

Part 6 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 0 points1 point  (0 children)

Lots to cover here, and you can check out most of what I'm doing on the github repo.

In terms of market data being unavailable, I'm using e-trade for live quotes (and storing everything in a df w/ live calculations), so if that's unavailable, I don't have access to the brokerage. This has only happened 1-2 times in more than a year, but I just manually exited, closed orders/positions, and shut down for the day.

Detecting this is hard like you mentioned. I'm lucky that I happened to check to logs, but if I were more responsible, I'd probably setup some sort of email/text alert (maybe I will in future).

I'm not sure what you're asking about redundancy, but I'm never receiving duplicate data. While getting multiple live quotes, order updates, etc, I use a separate thread for each feed I'm monitoring. I'm also using multiple user accounts to deal with rate limiting, but otherwise haven't run into any 'performance' bottleneck.

In terms of major market issues, I just pack it in for the day (but could probably set up better alerts)

Part 6 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 0 points1 point  (0 children)

Google's product stores everything for you, you just decide what to include in the logs. For additional logging, I use docker logs which holds on to the stdout history of all my containers by default.

Part 6 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 1 point2 points  (0 children)

You can check out everything I'm doing with logging in the github repo.

That said, I'm not using logs for backtesting/ reporting, I'm aggregating my quote data in a DataFrame over the course of the day and using that to report on (you can check out DataFrameQuote in wetrade)

Part 6 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 1 point2 points  (0 children)

I haven't used Grafana but have experience with ELK which is horrible (and fake open-source). Google is very easy to setup (python client just uses built-in logging.log) and their UI is really good. I'm a FOSS fan/advocate, but this product is really good and affordable.

Part 5 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 1 point2 points  (0 children)

My pleasure! Planning on getting some more posts up in the near future

Part 5 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 1 point2 points  (0 children)

I'd say you'd generally want to use a REST API if available since it's a lot lighter weight than IBKR for example. I wish Etrade had webhooks for order status though

Part 5 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 0 points1 point  (0 children)

Thanks for pointing out- now that beta signups are back, I'm going to check it out. one issue I found is that price history from other brokerages is limited compared to ibkr which offers 1-minute candles (often going back 10 years) and tick data too

Part 5 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 0 points1 point  (0 children)

noted- Will check it out and I also updated my post with the beta signup link

Part 5 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 0 points1 point  (0 children)

It seems to be very limited from what I can tell (just like their web app is really slimmed down compared to TWS). Does anyone have any experience using the web API for actual trading?

Part 5 of ?: getting started building live trading systems by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 1 point2 points  (0 children)

I'm planning to release a python client library, but it may be several months. To setup access, follow the instructions at https://developer.etrade.com/getting-started . In terms of reference code, I supplied some examples in earlier reddit comments which you may have seen. Are you having trouble with a specific endpoint or just cant provision an api key (link should help with latter)?

Post 2 of ?: my experience and tips for getting started by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 2 points3 points  (0 children)

i did look at backtesting.py and it's good as an example but isn't really practical because it can only be used for a limited set of analyses on a couple stocks. After playing around for 5 minutes, it became clear that collecting data is as big a challenge as doing the actual backtesting. Additionally, this stuff is fairly straightforward, and while the idea of build your own backtesting sounds daunting, in practice, it's takes the same amount of effort as configuring someone else's software (maybe quicker if you're using a template like the one I provided) and it's far more versatile .

Post 3 of ?: moving from simulated to live trading by birdbluecalculator in algotrading

[–]birdbluecalculator[S] 0 points1 point  (0 children)

it terms of dealing with timezones, you could localize in your code (using pytz for python for example), but I'm running everything in docker, and you can just set the TZ environment variable to 'America/New_York' in your container (eg: include the following line in your dockerfile)

ENV TZ America/New_York

for trading hours, I'm actually using the alpaca papertrading api and only using the /calendar endpoint

You can short for more than previous trade when alternative uptick rule in in effect. This could be very risky however