rm-rf-etc
Stock trading in Elixir
I have a private project which I’m thinking of making public, but I want to first see if there’s interest.
I think elixir is an excellent language for running automated trading strategies, and so I decided to build what I need from mostly scratch.
So far I have a state machine which tracks stock activity in whatever timeframe specified, and I have the code for the ATR, RSI, and MACD indicators. Each has been closely checked against the output from TradingView.
I’ve also written one strategy and done some semi-successful backtests but I’m still working to increase the quality of how backtests are conducted (to be more realistic).
I’m fine with keeping it private, but if others want to contribute I certainly wouldn’t mind the help.
Most Liked
CinderellaMan
@PJUllrich Indeed, I would be very interested - especially in those indicators - I would totally steal them ![]()
@rm-rf-etc TLDR: Please release it, many people will benefit from it
but it’s hard work to get contributions.
On a more serious note, I released a cryptocurrency trading “environment” last year and I believe that some people are/were using it but you need tons of marketing, introduction materials and tutorials, and “stuff” to get people excited to the extent of contribution. At least for me, it didn’t work out this way (and I had similar hopes that people will contribute as they will be using it and we will make it better together).
I think there are multiple reasons for it:
- some people just want to use a product (they don’t care about the code so much, Elixir makes it easier for them to modify it a bit and that’s it)
- some people are overwhelmed by the scale of the project (they need more dev docs etc - do you have any of those?)
- some people aren’t interested in the product, but they want to understand it for learning purposes - again you need even more dev docs
I would love to see more algo trading related stuff being released to the community as it would enforce the idea that this is what Elixir is good at, but it’s probably too early to expect people to contribute (it requires lots of non-coding related effort from you).
For me, to get people interested I gave up on docs etc - I started to record youtube videos and I can see people being interested far more than in “finished” code - maybe that’s the way to get people excited to do it - through videos develop system up to the level when people feel comfortable to contribute as they fully understand the design decision behind it.
I hope that this didn’t come across negative - I think we have a great Elixir community and chance here are much better to extend your project than in any other language.
rm-rf-etc
I’m working on something pretty fun right now, it’s a rust NIF for performant chart analysis. PineScript is a really efficient language for testing ideas, but its usefulness falls off as soon as you get past the basics, so I think there’s a neat opportunity to build an equivalent in elixir and rust.
The way that PineScript works under the hood is that it generates a table, where every candlestick in the chart is a new row in the table, and each variable in your script generates a column in the table. So I prototyped a fixed-length rolling table in elixir, but I think the performance boost from using rust and a NIF would be worthwhile. I’ve also wanted the opportunity to write a NIF, and just needed a use case I’m invested in.
Some additional motivation: PineScript also has zero support for strategies that involve more than one asset, so strategies like stat-arb are out of the question. I’m planning on solving that, as well as portfolio-wide testing.
I’ve spent a lot of time with QuantConnect lately but I keep coming back to elixir because python and C# both irritate me.
I will probably reimplement the trade indicators in rust and provide a NIF for elixir. I’m also thinking about the potential to write elixir macros to make indicators and trading rules really concise, but I don’t know if that will be warranted, I’ll see when I get there.
Just wanted to share this in case anybody is interested.
subhrashisdas
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









