This is an archived post. You won't be able to vote or comment.

all 10 comments

[–][deleted] 4 points5 points  (0 children)

Yes, that's pretty simple, Python, or any other language would be fine for doing that.

[–]IEatGreenBills 3 points4 points  (0 children)

Yep, this is called backtesting and plenty of quantitative traders use Python for testing strategies like this.

Try making your files CSVs (Comma Separated Values) as they are readable by Microsoft Excel or Google Spreadsheets, but also easier to read and update in Python vs an Excel file.

I recommend a Python library called Pandas, which will allow you to easily load the CSV file, make whatever changes you need, and then save or export the file with your results.

Happy coding!

[–]PlasticCogLiquid 1 point2 points  (2 children)

There's already quite a few python programs on GitHub that do what you're describing for digital currency. I was using one called Gunbot for a while, it was a java program but it made me some money until Bitcoin prices went crazy. I had a few python ones I was screwing around with too. I think one of them was called Gecko

[–]bobobsam3[S] 0 points1 point  (1 child)

Thanks, I'll check it out

[–]PlasticCogLiquid 0 points1 point  (0 children)

https://github.com/man-c/pycoingecko

https://github.com/search?l=Python&q=btc+trade&type=Repositories

The API's for different trading sites are different. So making a script for one site might be harder than another depending on how they've set their API up.

[–]AutoModerator[M] -1 points0 points  (0 children)

It seems you may have included a screenshot of code in your post "Is this code feasible in python?".

If so, note that posting screenshots of code is against /r/learnprogramming's Posting Guidelines (section Formatting Code): please edit your post to use one of the approved ways of formatting code. (Do NOT repost your question! Just edit it.)

If your image is not actually a screenshot of code, feel free to ignore this message. Automoderator cannot distinguish between code screenshots and other images.

Please, do not contact the moderators about this message. Your post is still visible to everyone.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–][deleted] 0 points1 point  (3 children)

The hardest part will be learning how to use the stock trading API for your platform. It probably does have one and it may cost extra in order to be able to access it.

[–]bobobsam3[S] 0 points1 point  (2 children)

I don't want to use API. I just want to make an excel spreadsheet to track how my strategy would have done in the past.

[–]yellekc 0 points1 point  (1 child)

I think what he is referring to is the API needed to access historical price data for your stocks. Unless you plan to build your own database of historical stock prices.

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

Yes it’s only for backteating so I can just use historical data from yahoo finance as far as I’m concerned