/ag/ algotrading general

In this thread we discuss algorithmic trading for both crypto and stocks.

Join our discord channel:
discord.gg/9GtGR3

Other urls found in this thread:

discord.gg/9GtGR3
theguardian.com/science/2012/feb/12/black-scholes-equation-credit-crunch
blog.robinhood.com/news/2015/11/20/new-integrations
twitter.com/NSFWRedditVideo

>discord.gg/9GtGR3
Your invite expired.

bump for interest

no point I already tried many times to get a thread like this going but never got any traction here this place belongs to them and should be renamed from biz to crypto.

well the board was made as a crypto contrainment board for crypto threads on /g/, so...

Anyway, I write Bayesian estimation algorithm at work and I'm thinking about writing a bot for an exchange. Until now I only wrote bots for social networks.

I'm a programmer but the prospect of trying to write an effective trading bot is intimidating to me, since I know plenty of large entities with teams of top engineers are already sitting on advanced products

Is there a way to still create something effective? Maybe look at a niche sector or collection of stocks first or something

this is whats stopping me too. like, there is a huge market for this. financial institutions pay serious money to serious developers to make crazy algorithms for trading. ive had ideas on stuff to do, and it'd be hella simple, but if it's as easy as i think it is, wouldnt everybody do it?

i feel like i have foolproof logic to make money using the robinhood api (0% fees/commissions). maybe i should just try it.

someone give me fucking algorithm, i have wrapped multiple exchange apis and built a framework, but have no fucking clue what kind of strategy to run

I can't imagine losing money with it, though
and the market is somewhat special.
You can do contrarian trading between ETH and BTC, accumulate, and BOTH going up.

Languages?

>lol this guy with a nobel prize in mathematics made this equation, it's fool proof!
>lol just make a program to do it!
>lol this is guaranteed money, there's no way this'll fail!
Reality: theguardian.com/science/2012/feb/12/black-scholes-equation-credit-crunch

I guess we can look at it this way: there are still plenty of idiots and those with "dumb money" losing in the market on top of the fact that it isn't a zero sum game. The people with serious trading houses are making money and that can be there's, but even a modest effort at optimizing the market can still yield a better return than average?

Idk. I'm practicing more with manual trading and understanding the market before I try to implement my own program.

C# and Java are my cornerstone languages, I've used many though. I know Python is preferred for statistics these days and scripting so I'd probably start with that, or C#. C# is really underrated and unfairly paired with Java's shitshow.

>I guess we can look at it this way: there are still plenty of idiots and those with "dumb money" losing in the market on top of the fact that it isn't a zero sum game.
Aye, this is the reason why online poker bots workt too.

The problem is that the market is too dynamic and irrational to peg down to a wholly deterministic equation. There is that chaos variable that needs to be factored in.

Someone has apis to crypto exchanges in for C++? Also where do i get enough data to train my ai?

Crypto is a zero sum gain. Every dollar I make came from someone's pocket. It didn't just appear out of thin air.

I'm talking more about stocks. I prefer not to deal with crypto's chaos.

They have a rest API. Older data can be found through undocumented API on bittrex.

Why would you code it in c++? You don't want to be going that low level for a trading bot.

so here's some prototype logic ive been working on lately. maybe someone here can help optimize it:

- manually input a list of bullish stocks to trade every morning/week/whatever.
- poll for prices every second. push those into an array.
- every time you do so, check to see if the last 5-10 numbers you just pushed show an uptrend with a .25% (or whatever) increase in price.
- if they do, buy, and set a stop loss for 1 cent below what you paid. continue polling for prices and push them to a new array.
- if any one number you push into the new array is .25% (or whatever) lower than any previous number, sell.

you will buy right on the upswing of every increase and sell right when it starts to go down. you can modify the percentages you use to get in and out of your positions depending on the stock's volatility and price. youll hit your 1 cent stop losses from time to time, but those should be more than canceled out by your gains.

you can add additional logic to block trading for a stock if it's down a certain % on the day, or if it hits your stop loss too often.

if im paying 0 fees and commissions (aka using the robinhood api), how can this fail? it seems so simple, i have to be missing something.

I can do python scripting right away, although I'm also not afraid of the compiled OO ones.
As I've written above, my idea so far is contrarian trading on BTC-ETH:
You buy into an ETH dip and as it goes up by pGain, you sell (1+fee)/(1+pGain) and accumulate the rest.
E.g. Say fee=0.25% and ETH went into a dip at 300$. There you but 1 ETH and wait till pGain=2/100 or 2% meaning it's up at
(1+pGain)·300$=306$,
and now you sell
(1+fee)/(1+pGain) ETH
i.e.
0.982843 ETH
which at 306$ is 300.75$.
So you get your cash back and gain 0.017157 ETH.

My idea would be to have a Baysian update on the expectation running how the next candle will look like. Your Python routine has 1 minute and you can, at each point in time, look back at n past events. At the end of the day, you can add coefficients in the algorithm and determine the "would have been best" parameters by finding what would have been the optimal strategy.

If you want to try something, you may write me at
axiomsofchoice.org

You'll hit stop loss too often. You'll perform a large number of trades and pay loads of tax. Who's going to let you poll every second? Also having it work that quick risks false positives, your 1 cent stop loss is at risk of being jumped by a quick down turn and you'll lose money.

Margin can fuck you. Stop losses are tricky.

Maybe adjust your stop and buy threshold according to liquidity/volume and current volatility?

I was going to start with something simple, tracking moving averages, selling on a trigger (low average) and buying back in at a "dip". I guess the difficult part is determining what is a bona fide dip/reversal and what is a dead cat bounce.

What trading platform would you use to execute a ton of trades like that?

That's an interesting approach. I wonder how common ML algorithms are in the market.

Because the ai is running on c++ and also some parts of the ai learning is in the gpu.
I also dont like dynamicly typed bullshit.
I need to run thousands of threads to handle the bot users, so modern c++ with boost or Folly futures is pretty fine for me

C++ relies less on server resources and is faster,

1 cent is nothing, even bullish markets swing a couple of cents. Bigger coins even more.

i guess algo trading is very difficult to bring into the winning zone if you don't understand the market (i.e. you have a model for every part of the market you can use).

If I go with 1 market, the data set is small enough to (at the end of the day) find the maxima in a 5 parameter spaces, say. Parameters will be stuff like time windows that are relevant, or the typical time you actually want to sit out a dip to collect profit.
Independent of trading bots, it would be very interesting to see how e.g. looking at the last month, the typcial dip depths and lengths at each time scale are, and with which variance. Once you can quantitatively say what e.g. the ETH-BTC curve typically looks like, you can find out the percentages (pGain of 2% or whatever value) that actually work. And here you can just run the optimization with the actual data of last week: If I would have played it like that, what would I have gained.
My approach is taylored to a growing market where you always eventually get out of a dip - which seems to be the case right now, crypto is generally bullish. You can set your total investment to 1k and "won't be hurt too much" if something goes wrong.

>See name
>KUNTner

but isnt crypto market essentially a chaos, rendering any kind of neural or whatever useless?

There are observable patterns disrupted by sudden moments of chaos (spike or crash)

I don't know if it's possible to do anything other than mitigate the bad case

>get the fuck out at a certain loss and negative velocity

sounds good to me, nothing to lose in trying. i've been thinking of similar strategies. i'll definitely share my code with biz once i get something going, but i need to do a little more debugging and testing first.

i feel like there should be bunch of arbitrary heuristics. would be interesting to see ml with Veeky Forums shilling word counts incorporated.

Discord link?

i figure ill hit the stop loss more often than not, but it should even out with my sick gains. all i need is a few good bull runs in a day to cancel out a majority minor cent losses.

taxes are whatever. afaik im not taxed on # of transactions, but on total gains/losses. and i have an accountant to file my taxes for me so number of transactions doesnt matter much to me.

havent looked into polling rates. youre right it's probably not going to be that frequent. especially not through RH. maybe i can hook up to a third party api for that. im sure there are pay services which do this that would pay for themselves with use.

ideally i wouldnt be fucking with margin. id have at least 50k in an account to do this. and id use robinhood. only completely free trading service i know of. and it has an api to boot.

not talking coins, talking stocks. but yes im counting on those swings. itll probably cause me to sell for more than a cent less than i paid, but the hope is that those losses will be overcome with my gains. all i need is to win ever so slightly more than i lose. even if it's a hundredth of a percent. then it's just a matter of putting more money into it.

would love to shitpost on your discord.
2bad no link

Reading through this thread, it doesn't sound like any of you guys are up to it.

Even if you can make a model that wins on test data, you run a huge risk of overfitting to that test data.

Robinhood has an API released?

I thought it was just in development. And as it's a free service it isn't the most reliable, lots of slippage. I would definitely start with a lower stop loss though, they are finicky as fuck.

Ok, if this thread is about discusing Algorithms that determines entry points and then allocate stop losses and exit points, do backtesting (stepforward whatnot), not interested.

But if this thread is about market making - booking both buy/sell points around a theo, and then re-assigning the bids/offers after each hit, then I'm very interested

>We don’t have a publicly available API but we are working to provide this in the near future.

welp, yeah i guess not. they have integration with some other apps/sites. quantopian looks to be promising just looking at it at face value. id have to look into it a bit more.

blog.robinhood.com/news/2015/11/20/new-integrations

Isn't that fraudulent?

Dead invite. Is there a fresh link?