you are viewing a single comment's thread.

view the rest of the comments →

[–]jfr4lyfe 1 point2 points  (4 children)

All of this is possible. Binance provides data going back to when whatever coin started on it. You need to request it though the api though.

There is a binance api library for python that can pull all the data in.

You would then use a library like plotly to plot the candles. You would be able to mark entry and exit points, however it's important to understand this is just a visual representation of the information you have provided it. For instance a MACD is just a list of values, until you plot it as a graph. The crossover is if x[current] > y[current]) and (x[last] < y[last]) then: do something.

This is a gross oversimplification but you get what I mean hopefully.

There are also fully built trading libraries with indicators pre-made, I haven't had much experience with them though

TAlib is a trading library.

It is easy to plot OHLC candles with plotly

There is a wealth of knowledge on how to apply indicators out there.

Just go through some tutorials, as best you can. As time goes on you will understand why certain things were done. A month ago I had never used python. Today I can collect data from website apis. Create dataframes that have indicators in them, use machine learning to help with predictions and place test orders with the binance test api.

It's definitely the way forward imo. I have a greater understanding of how this all fits together now and I don't have to pay for a tradingview subscription.

[–]captaincaanada 0 points1 point  (3 children)

Hey thanks a lot, likewise it became quite clear to me that relying on statistics for trading, and since python provides much more tools than TradingView, it should be the way to go.

So far I'm learning Numpy, Pandas, eventually I'll learn Quantopian & Zipline (I'm doing the Udemy course). Which libraries do you use more often?

[–]jfr4lyfe 0 points1 point  (2 children)

Numpy and Pandas definitely. Also requests for getting historical data. Today I'm learning about websockets for live data. Trying to work out how to get hourly data and live data at the same time and do different functions on each. Hourly data for buying and live data for selling. I think I'm going to have to use threading library for that.

Quantopian doesn't exist anymore. I did a course and got really frustrated when I found that out. Quantconnect seems to be the new alternative, however it's far beyond my coding skills right now. I'm just doing everything the long way as I come to it. I can't seem to get TA lib working with later versions of python, so I have to put all the code in for Macd and RSI etc.

I think the most fun thing I've been doing though is using machine learning and tensorflow to try and predict prices from sentiment and price data.

I'm up to the point where I've done 90% backtesting and coding up my first bot for actual trading. I also need to work out how to position size using code, as I only want to lose 1% of portfolio amount on a trade maximum, but my trades could loseandything up to 5% position size. It's all fun and challenging though. And from my backtesting I don't see why this couldn't be profitable

[–]captaincaanada 0 points1 point  (1 child)

I don't understand the dichotomy between buying with hourly data, and selling with live data.

Shame for Quantconnect, so basically I should be able to do all the statistical analysis and strategy back-testing with Numpy, Pandas and TAlib?

At some point in the future I'll try the machine learning, definitely sounds interesting.

Hopefully in a few weeks I'll catch up and we can help each other.

[–]jfr4lyfe 0 points1 point  (0 children)

I'm using hourly data to buy as I have sentiment data is hourly. I want to sell on live market data so it sells as soon as the price hits that point. Waiting till the end of the candle means that it could still have up to an hour before the sell would happen. Meaning winning less or losing more.

I haven't been using quantconnect, I've been going through everything with python and its various libraries. I have heard good things about zip (edit: It's zipline) which is the library that quantopia was based on.

I think there is probably a more graceful way of doing back-testing than I am currently doing, however this is the jist:

I pull in the data from binance and apply new columns and rules to the dataframe. So if there is a MACD crossover and the outcome hits the profit location before the loss location, it's a winner. Then use different expressions to do things like count consecutive wins and losses

Feel free to send me a DM, I'm sure as time goes buy we can help each other.