Algorithmic trading general

Let’s talk about writing and using trading scripts, whether to automate trading or just identify entry/exit points.

What platforms do you use? Have you had much success? Any good guides? Maybe this will be interesting.

Other urls found in this thread:

imgur.com/a/V1dnH
twitter.com/NSFWRedditImage

>Ruining crypto even more

I'm a CS student and have been giving this some thought, I'd be up for working with other Anons in making a bot

You didn't mention what products your talking about.

Ruining cryptos has always been the aim of this board

Honestly I just want to do forex. I don’t think crypto is worth it given how manipulable it is.

You can always develope a platform which can be tested and applied to any market. The best trading bots are never a one size fits all its having a system that takes in your own understanding of a given market or commodity

Of course. Thing is, I'm aware of a few coding platforms out there that do backtesting against historical data in a fairly out of the box manner. Quantconnect and Quantopian for instance do it, though the former is frustrating and the latter doesn't do forex as far as I can tell.

Try cTrader/cAlgo (C#) or Metatrader 4/5 (mql language is similar to C++)

There are already many different open source options available if you want to run a bot to trade crypto. The problem I found with all of them is that it's really difficult to actually predict how the markets going to do. The only way I could feasibly CA well-performing bought a louder than being developed would be to use machine learning trained against historical data and even then I still don't see how it would figure out when the real spikes are happening, such as a pump and dump.

The way I see it, the role of bots should always be constant monitoring and reaction time never active prediction. It should be able to recognize when a plummet or a moon is happening and get on it right away but the consequence of the boom or plummet should be up to the actual human analyst.

Its like having a dog on a leash, its going to chase stuff for you regardless but you have to be the one to decide how far that leash will go

>machine learning trained against historical data and even then I still don't see how it would figure out when the real spikes are happening, such as a pump and dump.

Actually a few years ago, back when "stock tip" spam was a big business, this one guy had an algorithm skim off those pumps because he could attribute the spam to a particular organized crime ring, and knew from historical data plus other spams when they'd start the dump, so it was simple to get out right before it started crashing.

If anything, bots ought to perform great against pump and dump because a proper bot script ought to get out at a profit target rather than letting it ride higher.

Like, I'm sure it's difficult to predict how shit is going to move, but there are lots of rules of thumb out there that ought to get you more ahead in the aggregate.

Yeah I've been looking into Metatrader. It's been a lot of years since I've done anything in C/C++, though it ought not be too hard to pick back up. Python was the last language I coded in regularly, though even that's faded.

I think I get what you mean, and yeah, there has to be active monitoring of the script and, for example, backtesting of different constant values to see if they perform better.

>tfw bot makes me 150 a week without me doing anything

I'll never share anything with you fags though. Cs students aren't nearly creative enough to get a good alglrithm.

>150 a week
Pfft

I mean that's off a 900 dollar initial investment and it compounds. 9000 dollars would yield 1500 a week.

Then why don't you put in 9000?

Because I'm poor.

Then what happened to your swag?

>picture has multiple macbooks and new $100 bills
>says he's too poor to invest in his own idea
that picture just screams insecurity
L A R P

Not sure what you mean. I invest other people's money and take 10%. This only gives 50 dollars a day total but it's liveable.
Pic was unrelated. If I was larping I wouldn't admit to being poor. Right now I have to resort to investing other people's money but hopefully that will change soon.

So just tell us what your doing...

Ok dude whatever, good luck but if you have nothing to add then don't bother posting

I mean I could copy paste my code here would that make you happy?

So what, 458% per year?

They say someone who claims to have an investment vehicle that does over 10% per year is almost certainly running a ponzi scheme.

Then i guess crypto is a ponzi. If you bought neo at 4 you'd have almost 1000%.

Yes please share and inform
Don't act like 2x-10k is crazy for crypto..

Probably wouldn't be helpful anyway. I'm more curious as to what a good algo looks at. Like just inputting technical indicators and weighting them in some way you've rigorously tested (or using machine learning to figure out weighting)? Computer vision techniques to look for chart patterns? Sentiment analysis on social media?

>They say someone who claims to have an investment vehicle that does over 10% per year is almost certainly running a ponzi scheme.

To be fair they just said to retard normies who fall for spam mail

My algo trading system did +60% in 2016 and I've already beaten that in 2017. How can it be a ponzi scheme when I am only investing my own money?

He's just falling for a dumb boomer meme

If you go around trying to sell your algo with those claims, then yes, I would suspect you're running a ponzi scheme or other scam.

Algorithms are easily testable though, you could simply run them through a simulation of market history

But I'm not trying to sell my algo or to attract investors.

Well you should be if its that good

By that time the guy is probably gone with your money. Or the algo is tuned to perform on historical data. There are lots of bad people out there.

Good for you.

No, someone who is promising over 10% per year to other investors is most likely running a ponzi scheme. That's an important difference.

>By that time the guy is probably gone with your money. Or the algo is tuned to perform on historical data. There are lots of bad people out there.

There's easy ways around that, like making them run it through a simulator with an encrypted results string

If it's that good he should just be growing his own stack, not diluting his strategy with identical competitors.

It depends on scalability. If you had something one of the big banks would want then you damn well want to take their payout for it. Otherwise you'll never match the capital return they can offer before some hoopelhead catches up on you

No, investing other people's money adds a stress factor as well as legal issues that I don't need in my life. The only reason I can see for taking on investors is to acquire more investment capital. I don't need anyone else's capital, so there is no utility in changing what I am doing.

>No, investing other people's money adds a stress factor as well as legal issues that I don't need in my life.

Grow the fuck up

It depends on what you're trading. Coins or low-volume stocks? Then yeah, you can wind up fucking yourself if your trading volume shifts the market.

Doing forex on the major pairs though? I don't think there's any risk of diluting your take because you're taking on other people's money.

>legal issues
At the rates you're claiming you could easily incorporate and retain a proper law firm that handles this shit. Then pay yourself a salary and don't worry about lawsuits.

As stupid as it may sound, FX is way more manipulated than cryptos. Trust me.

I'm retired, dipshit.

Here's the tl;dr user

If you "know how" to do it well, you still don't have the infrastructure to do it well i.e. low latency servers and enough devs to make a large system that is actually robust. Have fun with flash crashes making your system go haywire because you didn't put in enough safety constraints.

Not an argument, grow some balls

>what is over-training

You retards need to get into Veeky Forums a bit more and out of Veeky Forums

One of my issues is the exchange request limits. Still trying to figure out a way to get around that shit. I don't feel like getting my IP blacklisted for querying their API too often.

Any ideas?

>you could easily incorporate and retain a proper law firm that handles this shit

Why? To what end? I don't want to invest other people's money. I'm perfectly content doing what I am doing.

To make money
Holyshit

What's to ruined that hasn't already been ruined by a speculator's market run wild?

Yeah, I hear that a lot. I think that the capital requirements to significantly manipulate the majors, though (i.e., have to be world-class I-bank or nation states) mean an individual can still do fine with an adequate strategy. Maybe not become a multimillionaire, but at least live comfortably. The problem I have with coin markets is the ease with which they can be induced into panic.

I'm actually not talking about HFT. You don't need to be looking at prices with one-tick, or even one-second resolution to make money algorithmically.

>I'm actually not talking about HFT. You don't need to be looking at prices with one-tick, or even one-second resolution to make money algorithmically.

Absolutely, its all very variable and manageable, especially when it comes to how many individual indexes you want to be observing at once

Then make a scholarship fund with your profits. Who cares.

I'm already making more money than I need. Why complicate things?

Why not just live in a dumpster like Diogenes, whatever

You can make a bot in bittrex with like 30 lines of code in go. This is the super hacky one I run sometimes:

imgur.com/a/V1dnH

took me like 45 minutes as my first ever go project.

nice thread op, gonna contribute a couple of things as I dont want to see it die. How about a daily algo trading general? I think the area is incredibly interesting.

Ive been doing this semi-fulltime for the past 8 months now, thinking of diving in fulltime while the going is good. If you view trading as a zero sum game then crypto is in the perfect spot for small algo trading shops right now. Minor in comparison to quant/hft dominated markets like options and derivatives yet large enough to make a killing. Also, the competition is fucking drawing meme charts, once the quants move in it might get really fucking competitive but for now its all good.

Generally you wanna focus on market exploitation. For example with traditional quant analysis, the underlying focus is always spotting market inefficiencies rather than just forecasting and modelling alone. A good example is bot dominated platforms like yobit and coinexchange.io. Ive made some very good money over the past 3 weeks just spotting rubbish pnd coins like elix, rocket, f16, uni and all this shit.

Very simple algo too, not fully automated either just a trading assistant. I basically have a script running that polls both of those exchanges every 5 minutes, tracks exponentially smoothed buy/sell volume and notifies me if shit starts looking weird. After a short manual investigation, I get in early and sell at the top.

lol that's awesome user. thanks for posting actual code.

Rolled a Bittrex bot in Unity (can fiddle with the editor on desktop, can run it on mobile).
Nothing fancy; looks for pairs with a slight exponential growth, decent history, which aren't at an all time high, etc etc Draw a line describing where you're happy to take profit (over time) and where you're happy to bail out (over time).
Keeping it simple seems to work, but really it's much less hassle just to invest in a solid coin.

When you are young, it is sometimes hard to see that your time is your most valuable asset.

How about you niggers share done actual signals?
Put a 120 period Bollinger band on a 30 minute chart, but a buy order just on the top band after an upper breakout with a not-overbought stochrsi (default settings), check for news for positive sentiment.
Set a stops at 30% gain or until the candle return to the band

I've higher priorities than being some old sponge touching himself waiting to die. I'll die at 34 if I need to for them

Did your mother drop you on your head when you were a baby? You're really dense.

How often are you fetching those markets/order books?

Like i said in an earlier post one of my issues is querying their API too often and getting shut out, dunno how to deal with that.

Yeah whatever bud, enjoying your fleeting "time"

Join Pump and Trump for the latest signals on pumps, then you won't have to bother with this bullshit.

T.me/pumpandtrump

Fucking mess, but when sorted you can (maybe?) see for example that most of bittrex is on a bit of a decline right now. Except ARK, which is shit anyway.

Nobody gets out alive, and you don't get to take the money with you when you go. Why are you so irritated that I have already made my living?

now the example above really just works in very specific conditions and against a certain type of strategy (pump and dump here). When designing something more general it is important to first understand what it is you are actually trying to do.

Financial time series data has certain well understood properties, for example it is non-linear and non-stationary, it can be modelled by markov chain processes, important second order properties are volatility and its tendency to cluster (heteroskedasticity), mean reversion tends to happen in almost all markets, etc.

If one were to focus on plain time series analysis as the underlying entry/exit strategy for the bot then one would take some of these properties (in this case volatility and all of its related properties like clustering) and apply a model that takes this into account. For example one might start with a simple GARCH model and go from there.

The point is, it is important to understand what it is you are trying to do before actually trying to do it. Applying time series models makes sense because if you can induce stationarity in non-stationary data that means youve explained away significant statistical peaks in the time series and can now make predictions.

And this is just one approach obviously. Quants tend to focus on volatility modelling, CS people just put some kind of deep neural network combo like a CNN+LSTM ensemble on top, etc.

Because its degenerate and unChristian, a man should give it his all to the last

Every 5 minutes, I do run it over multiple proxies though. yobit gives no fucks, you can hit it up every second if you want lol but coinexchange is a pain in the ass with this.

I see. It will really piss you off to learn that at this point I only have to spend about 15 minutes a day maintaining my system. The rest of my day is generally spent doing whatever the fuck I please. Life is good.

I think the crypto market tends towards chaos no machine learning would be useless. That said I write scripts to help me trade rather than decide to trade for me. Written scripts in python for alerts on various parameters (ie volume, price etc) from Bittrex. The holy grail for me is making a small app on my phone for selling off percentages of my coins as they hit those peaks. I guess I would need a mobile app to communicate with a script running in aws that interfaces with bittrex. I find it really easy to judge these swells in price when looking at blockfolio.

Also toyed with the idea of a deadmans switch when with one click of a button you cash out all your alts to BTC and its sends its straight your BitPay account.

Could be used also for when BTC does those big dips and you want to exit all your Alts for a shortperiod of time and then buy back all those alts again when it hits a bottom. I could only ever judge this myself by glancing at charts (which i fucking do all the time anyway). Id be too afraid to test this automatically. That said you could build in some variables with support values etc but you would have to manually do the donkey work here.

Would be pretty cool to have a Biz repo of python scripts etc.

Good man user. Sounds tight.

Sounds awesome. How can I get access to your script?

.25 btc and I'll send it to anyone willing to pay. Laptop died and had to change to desktop, sorry

gtfo out of here lol

Its not for sale I'm afraid user. However, if you want something similar look into something called cryptoping (I believe), they send you entry signals and as far as I got use buy volume as an indicator. No smoothing is applied so its probably very noise, but for identifying pnds it should be enough.

bro. fucking nice. i use unity for my bot too. how did you make that graph? thats the only thing ive no clue on how to do.

Biz is my shitting Street...

Superpower by 2020.

Have you considered working with market indices in actual markets??Implications on the Dow with trumps tax cuts and major first and second World issues such as the australian debt crisis would make a lot.
Australian crude reserves are also at a all time low, with not enough suppply to keep the country going( 34 out of the recommend 45 days).
Even oil volatility can make money with leverage .

Yeah, honestly if you've got the ability to code something to parse report text or mine data from news sources you could conceivably destroy the commodities market. I used to be able to code that kind of shit, like nearly a decade ago. Fucking sucks when skills erode.

Isn't over-training a problem only with machine learning? He didn't specify he was using ML.

>Isn't over-training a problem only with machine learning?

No not at all, it only becomes exponentially more common with ML

Buy volume on an short ema for smoothness? That's it?
Shitty that it can't be backtested, but thanks bro

I'd call it "overfitting" or "overtuning" when talking about rule-based strategies. Just because configuration A outperforms configuration B on your test data doesn't mean configuration A is generally better.

In fact, if you could configure a rule based strategy to perfectly exploit every opportunity across your test data, it'd probably fail horribly on other data.

I think when configuring an algo it'd pay to use the same strategies they use for ML: Break your test data into ten segments, do your tuning with nine of them until you're satisfied, and then run it on the tenth. Then rotate the segments and retune. At least that's what we used to do when we'd train classifier algorithms back in college. Also get familiar with the statistics for evaluating algorithm success: accuracy is only one. We used precision, recall, and f-measure. I'm not sure how applicable they are to financial algorithms but they were invaluable in producing a useful classifier algorithm.

That makes more sense.
I haven't heard about cross-validation used out of machine learning.
People say the market is too unpredictable to use machine learning but if there's anything i know is that there have been a lot of uses "discovered" by chance.
If ML were to work to predict price changes it would have to take into account news and social media.
I watched Hypernormalisation by adam curtis last week and I was wondering if anyone knows about the aladdin platform and how it works.

Honestly, you are dreaming here...
This type of linear stuff will be annihilated in a "real" competitive setting. Especially, anything relying on sentiment analysis or any type of NLP applied to public sources. First off all youll never be able to match firms trading on closed information unavailable to you, second, it will be trivial to pick up your bots pattern and pretty foolish of any serious player not to do so.

Machine learning is used on financial data right now. Its been used in finance since decision trees became a thing. People just think of neural networks when they think about machine learning, but thats not all.

The overfitting problem is present in any non-linear approach. It just means your algorithm is not generalising well enough. Specifically, with time series data, it means the statistical peaks it identifies are only local rather than general.

Non-linear methods are also very hard to explain in reverse, which makes them somewhat unattractive in finance. You dont want to rely on a blackbox when handling money.

All of this said, machine learning is absolutely used. From various ensemble methods (like extreme random forests), to svns to even more experimental stuff like reinforcement learning/q-learning agents.

One of my own algorithms uses random forests with engineered indicators to make market movement predictions. It just comes with its own can of warms as I said. For one, its not as easy to validate this type of model mathematically when compared to volatility prediction. Extra care has to be taken with avoiding various biases that might lead to overfitting or other problems (lookahead bias, selection bias, etc). More testing is involved in general.

I prefer linear methods myself but sometimes a linear method cannot capture all of the information successfully.

Yeah, you're probably right. Still, there ought to be enough left there to make some money. Honestly I'm just thinking about what I can do with where my skills were. Or at least somehow linking things back to my old skillset.

Also, I don't know about "aladdin", but if you are looking for a purely quant/algo based fund look into renaissance technologies. I can even tell you what it is they are doing in principle, but remember, predicting and forecasting is only half of the game (not even that).

If you go on arhivx and search for time series related research, all the algos are there for you. If you are comfortable with linear algebra and applied multivariate calculus you should be able to replicate any results published. State of the art is something in the 70%-80% range right now, and that still wont make a winning bot...

>manipulable
>but giving money to an fx dealer
kek

>If you are comfortable with linear algebra and applied multivariate calculus you should be able to replicate any results published.

Well fuck.

Any suggestions on how to get comfortable with that when you're more than a decade out of undergrad?

Focus on crypto.
If you had those skills once youll get them back up in no time. The advantage is, no serious firms are involved. I bet even NLP stuff on crypto will work really well. And if you combine it with some other stuff you are probably half way there already.
Like for example traditional TA as in lines-crossing-other-lines rarely is any better than buy-and-hold when it comes to stocks. But here, combined with sentiment analysis and some kind of risk assessment model like hidden markov states it would probably work rather well.

That came off unnecessary complicated sounding on my part, sorry. Wasnt intended this way. I only mentioned arxiv because you can find most of the cutting edge stuff on there and linalg and multivariate calculus is all you need, which in comparison to more abstract math is still very accessible. So any hedge fund employing 100 phds is already ahead of you when it comes to securities pricing, derivatives, etc.

If you are asking how you can become comfortable with the math its not really that hard if you are willing to put in some work. I can write up a few suggestions if you want.

>If you are asking how you can become comfortable with the math its not really that hard if you are willing to put in some work. I can write up a few suggestions if you want.
Another user here, but really interested in your suggestions.

forex brokers, cfd brokers for example, do not 'manipulate' markets it's impossible.

banks such as goldman and citi however usded to clip their clients out as you can see where their stops are. that's if your trading lower market cap stuff with larger sums

>If you are asking how you can become comfortable with the math its not really that hard if you are willing to put in some work. I can write up a few suggestions if you want.

Well I was thinking if you could recommend some readings, recognized texts, stuff I can work through on my own rather than “You need to go take a class.”

Like I get the thing with math is to read the principles and practice it over and over through problems. I’m not so old I’ve forgotten that. But it’d be nice to have a roadmap, so to speak, of the topics that need to be covered.

Alright, I'm gonna assume no hard math knowledge. The obvious stuff first:
> Statistics
I'm not gonna state the obvious reasons why this is necessary, but when you are doing model selection, validation, etc you need to understand what the results are actually telling you. "All of Statistics" by Wasserman covers pretty much everything.
> Calculus
Surprisingly little calculus is actually involved. And unless you are really interested in the math or you are doing heavy derivatives work, you really only need to understand this conceptually. "Calculus Made Easy" by Thompson will get you there. Over 100 years old, doesn't really touch on limits, but its probably the best book written about the nature of calculus.
> Linear algebra
Now this you really need to know very, very well if you are planning on doing any ML work. Traditional finance too will involve a ton of matrix operations, etc. Also youll need this to comfortably read published research. Pick up "Linear Algebra" by Lang, an amazing first introduction.

Now those three out of the way and you can focus on more applied stuff.

> Time series analysis
In other words dealing with data that is presumably temporally correlated. Specifically applied to finance youll be dealing with temporal effects on volatility, its clustering, etc. Most of TA is a simplified version of time series analysis in some form or another. The objective is always the removal of correlation in a given series of data, which allows you to treat it as a stationary object, hence make forecasts. Look into "Time Series Analysis and Its Applications" by Stoffer.

This is getting a bit long now lol, gonna continue in another post

you know yourself that thats the point where you want to be, not where you are right now.