[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/biz/ - Business & Finance


View post   

File: 5 KB, 315x145, Capture.png [View same] [iqdb] [saucenao] [google]
4321911 No.4321911 [Reply] [Original]

i've made a shitty php bot for bitfinex. it buys if price goes up and sells if price goes down. with 3.3x bitfinex margin. checking the price each minute.

wish me luck, will post progress. pic related is the initial bot balance (0.02 bch with leverage)

>> No.4321934
File: 468 KB, 617x731, camera.png [View same] [iqdb] [saucenao] [google]
4321934

Would you suggest PHP or Python for such types of programs?

>> No.4321946

>>4321934
either is fine

>> No.4322030

>>4321934
>using a weakly typed language for financial transactions
you probably encourage your sister to go to rap shows

>> No.4322035

>>4321934
irrelevant. i just googled "bitfinex bot example" and went with the language of the first google entry

>> No.4322056

>>4322030
>financial transactions
you just use it to access the bitfinex api, you dumb cuck

>> No.4322237

>>4321911
ok, i had some problems with shorting, but now everything should work fine. i'll keep you posted

>> No.4322320

>>4322056
You are even more retarded than I thought after your first post

>> No.4322770

>>4321911
That’s right anon, buy hi sell lo

>> No.4322795

>>4321911
How do you determine if price will go low or high?
If you're buying when price goes high and selling when price goes low... You know what it is.

>> No.4322809

>>4322770
>>4322795

>checking the price each minute
i'm too fast for buying high selling low. if it's a rally then i ride it, if it inverts then i close and lose 0.5%

>> No.4322991

>>4322809
That's actually genius, it's like a brute force bot.
Reminds me of PSAR people who put stop losses at -0.1%.

>> No.4323029

>>4321911
>it buys if price goes up and sells if price goes down
Truly /biz/ incarnate, good job anon.

>> No.4323054

>>4323029
trust me, i'm sure it will work.

i'm still fixing shorts, bitfinex' api documention is awful

>> No.4323089

>>4323054
So when will it be up and running?

>> No.4323118

>>4323089
very soon. longs work well, and closing orders too.

the decisional logic is perfect.

the only problem is that short requests aren't working.

anyway, maximum 30 minutes and it's running

>> No.4323272

>>4321911
My experience with my bot has been that the most advantageous times to get in are when shit has flash crashed. I know they say not to catch a falling knife, but it's been working well for me so far. +30% in a month and climbing (even despite all this fucking fork drama)

>> No.4323292

>>4323118
What's the decisional logic? Or would you rather keep it a secret?

>> No.4323338

>>4321934
no PHP is total garbage. It's the official language of rural India

>> No.4323350

>>4321934
Node. It's what Python always wanted to be, and much better suited for web.

>> No.4323353

>>4323272
good idea for an entry, but it's too bothersome to code.

checking previous price and setting a bunch of ifs is way easier

>>4323292
i wrote it in the op. check price each minute and ride the wave or cut losses.

>> No.4323431

>>4322030
>python
>weakly typed

>> No.4323499

>>4323353
Aren't minutes a bit too slow? Why not follow the buys/sells in the realtime and weight them by volume?

>> No.4323520

>>4323499
it's exactly 1 minute, which is good enough since it should avoid the retarded random dips and shit. maybe 30 seconds would be better, i'll check later

>> No.4323587

for example, in the last 5 minutes of testing, the bot bought at 1306 and sold now at 1238

>> No.4323716

>>4323587
Buy high sell low, the official biz bot

>> No.4323750

>>4323716
i ment the opposite, ffs

>> No.4323753

Please dont tell me you didnt even backtest this "strategy"

>> No.4323798

>>4323338
kek

>> No.4323809
File: 39 KB, 1613x331, Capture.png [View same] [iqdb] [saucenao] [google]
4323809

>>4323753
>implying

>> No.4323857

>>4323809
oh, and this is the last 24 hours

>> No.4323881

You releasing this, or do we have to implement it ourselves form your one line description?

>> No.4323924

>>4321911
the way your strategy works is buying for e.g. 10 minutes each minute, so 10 times at an increasing price each time
then, if at the 11th minute the price is less than at the 10th minute, you sell all previously bought btc
so you sell 9 trades for profit, the 10th is at a loss.

how do you save yourself from trading fees?
i don't know how high bitfinex' fees are, but i'd take a guess with 0.25%

i'd imagine that the high buy frequency works perfectly in theory, but the price has not enough time to increase so far that your fees are covered

the same strategy would work almost perfectly during 2017's summer if you took some hours as your base time unit

am i making sense or do you not get what i'm talking about?

>> No.4323983

>>4323881
looks like the short are working, almost done.
you can post this "code" into pine editor on tradingview to backtest it: //@version=2
strategy(title = "Poorfag's road to Lamboland", default_qty_type = strategy.percent_of_equity, default_qty_value = 100, initial_capital = 10000, overlay = false)

buySignal = ( close > close[1] ? true : false)
sellSignal = ( close < close[1] ? true : false)

if ( time>timestamp(2017, 11, 11, 0, 0))
strategy.entry("simpleBuy", strategy.long, when = (buySignal == true))
strategy.entry("simpleSell", strategy.short, when = (sellSignal == true))

if ( time>timestamp(2017, 11, 11, 0, 0))
strategy.exit("simpleBuy", "simpleBuy", when = (sellSignal == true))
strategy.exit("simpleSell", "simpleSell", when = (buySignal == true))
>>4323924
it's more stupid. i just buy once the price start rising, and sell/short once it starts falling. pyramiding is too hard to code atm

>how do you save yourself from trading fees?
usually i don't, but bch goes +-10% in minutes, that's how

>> No.4324001

>>4323809
What site/interface is this?

I like the simple logic. No ai and ml buzzmemes

>> No.4324075

>>4323983
I'm not super familiar with Pinecode, what is the "timestamp"?

>> No.4324112
File: 71 KB, 1539x329, Capture.png [View same] [iqdb] [saucenao] [google]
4324112

>>4324001
tradingview

anyway, looks like the bot is running. let's see if i coded it properly

>>4324075
since backtesting only supports 2k trades, it's used to limit the first trade to 11/11. technically it's not needed

>> No.4324173

>>4324112
Ah. So it's pretty much "last candle closed over the previous candle" or "last candle closed below the previous candle". Easiest thing ever, amazing.

Obviously you do some price tracking after that to check for the inversions, right?

Do you think checking against simple uptrend/downtrend would help the bot or only make it unnecessarily harder for it?

I'm a huge fan of your solution, it's simple as hell and easy to implement.

>> No.4324195

>>4324173
you can make it 100x time more efficient but i'm lazy, i just want to get the barebones version running atm

>> No.4324211
File: 27 KB, 500x500, image.jpg [View same] [iqdb] [saucenao] [google]
4324211

>>4321911
Can I have the download link? i just lost a fuck ton on bch

>> No.4324215

Be careful now when people are dumping BCH for the difficulty adjustment

>> No.4324229

>>4324215
the bot can short too, no worries.

i'm moving everything from my rpi to my desktop so i can run it without a hassle, 10 more minutes

>> No.4324244

>>4324229
I want to buy it
Can you sell it to me

>> No.4324246

>>4324211
If you don't know how to implement it yourself, you probably couldn't get it working.
Get some API keys first.

>> No.4324247 [DELETED] 

>>4323983
is this the entire code

>> No.4324275

>>4324244
if it works yes, i'll sell it for pics of sharpies in poopers

>>4324247
for backtesting yes. the php code it 100 times longer

>> No.4324306

>>4324275
So it doesn't work yet? Fuck off

>> No.4324327

>>4324306
rude. there isn't that many algo threads on /biz/ so don't hate him for trying.

i'm working on a python script! keep up the good fight anon-sama, php and you can do it!

>> No.4324328

>>4324306
wifi is shit, i'm moving it to another pc. and i need to install php here

>> No.4324352

>>4324328
Anon I'm sorry
Add me on @bendthatdick telegram
I know a some Java lel

>> No.4324353

>>4324306
>So it doesn't work yet? Fuck off
Read the thread, dumbass.

>> No.4324414

I just implemented this and backtested it with minute candles I've procured since 2011 starting with $10,000 and it lost every penny. I also tried not starting the strategy until 2015 and it still lost every penny.

>> No.4324436

>>4324414
it only works now on bch because the volatility
and volume make it possible to cover the exchenge fees

>> No.4324489

>>4324414
Can you show your work?

>>4323983
What's a pine editor?

>> No.4324575

Buy/sell price is just market close of current row
Calling buy() or sell() twice consecutively is equal to just staying in the current strategy (it checks).

Oh and btw, I changed from comparing closing prices to comparing SMA15, and it actually tripled the starting money on $10,000 to my surprise lol.

Formula for buy/sell:
tradeFee = 0.0025
feeCoeff = 1 - tradeFee
USD = price * BTC * feeCoeff

startDate was Jan 1, 2016

readRow(row) {

price = row.close;

if (lastRow && row.openTime > startDate) {
var buySig = row.SMA15 > lastRow.SMA15,
sellSig = row.SMA15 < lastRow.SMA15;

if (buySig) buy();
else if (sellSig) sell();
}
lastRow = row;
}

>> No.4324579

>>4324489
it's a an editor for trading view's coding language

oh, and looks like i can't install php on windows

>> No.4324669

>>4324579
You can, use xamp.
If you're running it from a command line, there's gygnus. Or just install vagrant and do it that way.
chocolaty would also work if there's any kind of windows package.

>> No.4324716

>>4323809
>>4323857
so a 24 hour backtest? lol sounds pretty reliable. Why dont you run one over lets say a months data, with fees and slippage. Then post your sharpe and your drawdown?

>> No.4324757

>>4324716
i'll run it on the live data once xampp finishes downloading

>> No.4324793

>>4324757
why tho? you could easily test it on historic data without risking any money

>> No.4324830

>>4324793
i tested it on the last 2 day on trading view. as i said, this shitty strategy can only work because of the current volume/volatility of bch. so it's now or never my friend

>> No.4324839

>>4324793
You don't need to play with real money to test live. It's called paper trading.

>> No.4324891

>>4324839
>>4324830
oh I see, missed the trading view bit. Assumed you were about to run it live as in real money, real exchange. Good luck though anons, I'm trading the bch/btc volatility myself but with a hedging model

>> No.4324940
File: 9 KB, 392x115, Capture.png [View same] [iqdb] [saucenao] [google]
4324940

Uhh guys...

10K to 1.5M in 4 years?

>> No.4324945

update: short and longs are working, i've setup everything on windows. now it doesn't close orders... but it should be easy to fix.

almost done famalams

>> No.4324962

>>4324945
Keep up the effort. Sounds rather interesting

>> No.4325004

>>4324940
yeah that looks pretty wrong lol...

>> No.4325020
File: 97 KB, 1050x590, 1504794355404.jpg [View same] [iqdb] [saucenao] [google]
4325020

>>4322030
>rap shows
>not beneficial to an extroverted personality type
I recommend all the rap shows

>> No.4325045

>>4324830
Fee and spread alone gonna kill your profit

>> No.4325050

>>4325004
right, should be a lot more

>> No.4325081
File: 488 KB, 2048x2048, 1498950910623.jpg [View same] [iqdb] [saucenao] [google]
4325081

>>4321911
Did you back-tested the algorithm OP ?
Also, where can I get 1min candles
data to train algorithms ?

>> No.4325105

>>4325045
stay poor pleb

>>4325081
yes, read the thread

almost everything is ready btw, fixed closing positions

>> No.4325119

>>4325050
coding an algo right now to try and exploit your algo thxfam

>> No.4325128

>>4325020
seriously though that comment i replied too was dumb af. go to a rap show and there's about 1000 people trying to fit in and being goofy

>> No.4325131

>>4325105
Can't wait til you lose all your money.

>> No.4325136

>>4321911
good job, but ...why the fuck would you choose .php?
>of all of the hands that you might place you digits into, you place them in the hands of the people who will not hesitate to put your digits into their pockets

>> No.4325151
File: 14 KB, 480x360, spurdo.jpg [View same] [iqdb] [saucenao] [google]
4325151

>>4325081
damn thats my female form/wife

fug

>> No.4325154

>>4325119
>exploit

more people doing this shit the more it becomes a self-fullfilling profecy. i'll share it for free once it's foolproof

>>4325136
the first btifinex api example i found was in php. too late anyway

>> No.4325219
File: 12 KB, 313x304, Capture.png [View same] [iqdb] [saucenao] [google]
4325219

it's on!

already made 22 cents including fee

>> No.4325261

>>4325154
nah you didnt get me bro, 'exploit' as in 'exploit your strategy'. I'm only kidding though, aint got
not time for this shit. Good luck with your script though I'll be watching this thread

>> No.4325319

>>4325219
Great. And it only works for BCC? Could you set it up for other currencies on bitfinex?

>> No.4325372

>>4325154
fair enough bitbro
>good fortune to you
>but the idea needs to be converted(later) to a language that isn't compromised by a people who are born spies, deceivers, liars, manipulators and thieves at heart. no offense

>> No.4325400

>>4325319
like which one? i can backtest on trading view but i doubt it'll work since the volatility isn't this high

>> No.4325444

>>4325400
Litcoin and Monero? I get that volitilty isn't high but you want a bot that can work even when volitilty is relatively low. Right?

>> No.4325481

>>4322056
topkek

>> No.4325505

>>4325444
yes, but not with this shitty strategy. if you have a proper strategy for those coins then altering the bot is easy

anyway, since the price went up and i can't affor 0.02 bch (minimum trading amount), i'm moving some eth to the bot's fund.

it will be back up once the transaction is complete and i'll post live updates

>> No.4325550

>>4322030
>being emotionally invested in a programming language instead of just seeing them as a tool
>not realizing that the best programming language is the one you're most familiar with

>> No.4325599

>>4325444
i just tried.

for reference, i got +15000% on bch in 24 hours.

i get +78% on ltc and +95% on xmr

counting fees and slippage, it doesn't look that profitable on those

>> No.4325638

>>4325550
Do you even understand what his criticism is?

>>4325599
have you tried changing the logic in the code to take fees into account? e.g. subtract fees from the sell price and add them to the buy price.

>> No.4325740
File: 88 KB, 640x850, 1510342734901.jpg [View same] [iqdb] [saucenao] [google]
4325740

where did you get the historical data?
i've been meaning to write a bot to flip ETH or BCC so that i dont have to put any effort into being a whale
i know you can get from e.g. https://bittrex.. com/Api/v2.0/pub/market/GetTicks?marketName=BTC-BCC&tickInterval=oneMin
but it only goes back 10 days

>> No.4325762
File: 50 KB, 663x707, 1506857124931.jpg [View same] [iqdb] [saucenao] [google]
4325762

>>4325740
>being a whale
becoming a whale, i mean

>> No.4325770

>>4325740
trading view's pine editor has all the data you want

>> No.4325807

>>4325599
OP can you pls share your resources I want to try and make one, I know python but I have no idea where to begin with this

>> No.4325812

>>4325638
>have you tried changing the logic in the code to take fees into account?

i tried it on trading view, with the taker's fee i got "only" +60% in 1 day. with maker's fee it's +1500%.

i think there is an option to do post only order in the api documentation

>> No.4325814

>>4325770
thanks, is it downloadable though?

>> No.4325841

>>4325807
google [you favourite exchange] [your favourite language] bot and tweak it

>>4325814
doubt it. exchanges usually makes you pay for downloading a lot of old data

>> No.4325881
File: 19 KB, 500x590, tosmart35.png [View same] [iqdb] [saucenao] [google]
4325881

>>4325841
thats a shame, i'll see what i can do about it then, maybe 10 days of 1-minute interval data is enough
hopefully i'll get something working so i can brag about being NTR'd by my own bot on /biz/

>> No.4325895

>>4325812
>i think there is an option to do post only order in the api documentation
Is that even possible? I know kraken determines it based on whoever placed their order later paying more.

>> No.4325905

>>4325841
Will you be sharing this code with us?

>> No.4325946

>>4325895
oh, found it. i'm placing order's with post only and close them without

according to tradingview that should be +300% or something in a day

>>4325905
if it works yes, but it's a shitty strategy just for giggles. it's way harder setting up php server on windows than writing the strategy

>> No.4325978

>>4325946
How much are you putting into it to get these numbers? I assume the simulation on tradingview has a limited amount of one currency at the start.

>> No.4325987
File: 108 KB, 767x401, hmm.jpg [View same] [iqdb] [saucenao] [google]
4325987

So, I ran your barebones tactic of buy when previous close under current close and vice versa against some trading pairs on bittrex. this backtest is using 5m candles and spans around 10 days. note however that this is not the most current data, the last timestamp is from 07/11/2017 6:20pm.

You might wanna add a check if something is very volatile (like bcc currently).

>> No.4325995

>>4325978
you can setup everything on trading view except slippage i think. so fees/initial capital/contracts/piramiding/etc

>> No.4326046

>>4325946
From your tests, it looks like it would work.

>> No.4326096
File: 6 KB, 308x172, Capture.png [View same] [iqdb] [saucenao] [google]
4326096

>>4325987
>using 5m candles and spans around 10 days
this tactic is awful for anything above 1 minutes imo.

after this pseudo flippening end i'll tweak the bot with a good slower strategy.

but biggest issue with backtesting is that it fucks up the EMAs and gives buy/sell signal based on future prices (at least on tradingview)

anyway, the bot is on. i'll leave it running until midnight at least, will check back soon

>> No.4326108
File: 41 KB, 600x600, 1509730058593.jpg [View same] [iqdb] [saucenao] [google]
4326108

>>4323716

>> No.4326175

>>4326096
hold on a sec, gonna test it against 1m candles, just gonna take a while.

>> No.4326310

>>4326096
Do you have Kik?

>> No.4326396
File: 79 KB, 749x327, hmm2.jpg [View same] [iqdb] [saucenao] [google]
4326396

This is the strategy in 3 days of 1 minute candles trading. I'm gonna see if I can make it profitable (at least in the backtest) with some tweaking. Gonna report back in half an hour or so.

>> No.4326438

>>4326310
nope

>>4326396
the bot is already running, we'll see how it does anyway

>> No.4326561

>>4326438
Email?

>> No.4326998

>>4323350
kek
even the Node dev jumped ship to join Golang a few weeks ago
Node has always been a joke
I always said it, never drank the kool aid

Go > Erlang > Python3-asyncio > Node >>> PHP

>> No.4327144

>>4326998
>being emotionally invested in programming languages
lmao, I never understood why people would talk shit about people using other languages. there are only two kinds of languages: the ones people complain about and the ones nobody uses.

>> No.4327288

>>4327144
there are two types of people : devs and nodevs

>> No.4327341

>>4327144

Node falls into the former though. Gotta love callback hell. Async is supposed to be simple.

>> No.4327439

I guess OP is gone

>> No.4327716

>>4326998
> Go above Erlang
You absolute motherfucker you

>> No.4327890

>>4327341
I agree, callback hell is no joke and it took me a lot of time to wrap my head around. But it does get better with time, especially with features like async / await etc. there's a lot of work being done and I think it gets better every day.

Anyways, with two other indicators added to the mix to filter out unprofitable trades, it made 8% profit in 3 days with 1m candles. Op if you like, post your PGP public key and I'm gonna post the encrypted parameters for the indicators.

>> No.4327963

>backtesting bitcoin

Fucking stupid
If you would have HELD AND DONE NOTHING you would have made bank

Unless you are scalping transactions you are literally just pissing in the wind

>> No.4328026

>>4322030
This.
What's that python? You won't tell me when I glance on ha key mutating a variable on a crucial line of code?
>Losing lots of money
Neat

>> No.4328099

>>4321911
Hi, im also working on one. What are your triggers for the bot to select a coin and think "Buy this". A certain amount of drop from a high or..?

>> No.4328181

>>4328099
He's gone.

>> No.4328318

>>4326998
Java vert.x > all of them

>> No.4328446

>>4326998
Asynchronous code in Python is ugly as fuck compared to promises and async await. I will admit that Go is faster than Node but that's the only advantage, and it doesn't really matter since you're not doing high frequency trading. Node's syntax is far superior to Go. And Erlang is just for autists.

>> No.4328467

>>4327716
Is Erlang any use? What about D?

>> No.4328474

>>4327341
Callback hell only happens if you're a shitty programmer who uses callbacks instead of promises or async await.

>> No.4328508

OP just lost his money to fees and spreads

>> No.4328530

>>4328508
He is looking for a good pink wojak for his return once he pussies out of kys

>> No.4328550
File: 5 KB, 307x160, Capture.png [View same] [iqdb] [saucenao] [google]
4328550

>>4328508
yup, rip.

even if i blame more the sideway movement for the last 2 hour.

on the bright side, the bot works perfectly. i'll try setting a serious trade strategy for it later

>> No.4328668

>>4321911
Every minute? Bitfinex has socket API, that is realtime. PHP? Idiot.

Also backtesting with finex data from last 12 month shows that your strategy won't work.

>> No.4328782

>>4328668
i guess your bot is written in go

>> No.4328820

>>4328318
t. 32Go RAM
>>4328446
>compared to promises and async await
python has those

>> No.4329032

>>4323983
>buySignal = ( close > close[1] ? true : false)
>sellSignal = ( close < close[1] ? true : false)

Why the fuck are you using a ternary operator here you fucking autist

You already have a boolean

>> No.4329045

>>4329032
i just copypasted someone else's code and changed the variables.

no bully pls

>> No.4329051

>>4321911
Of all the languages you could have used. Why the fuck PHP which is basically for rendering web pages?

>> No.4329105

OP: run the code on recent history before you run it live

>> No.4329149

>>4329051
I'm gonna take a wild guess: It's the language he's most comfortable with.

>> No.4329279

>>4329149
My 3rd programming job I worked at a place where all the backend code was written in PHP scripts running on windows server 2012.

They started the php tasks using windows task manager.

Lets just say I have first hand experience of how shitty of a language php is for periodic / backend tasks like this.

>> No.4329298

>>4329149
and get easily triggered when people try to use php for backend tasks

>> No.4329310

>>4329105
How do you collect recent history?

>> No.4329363

>>4329279
>>4329298
I know PHP as well, and I would agree with you that other tools would be suited better. But still, I don't get the bashing by everyone. If it works for him?

>> No.4329439

i literally used the first language i found the api for.

i made a big for loop inside a php script, that's it. it's not like i'm deplying or shit

>> No.4329525

if coding profitable bots for crypto were so easy, wouldn't the market have been littered with them already? I'm sure a whale would buy one for 10k in a heartbeat

>> No.4329600

>>4329525

Nobody is selling their bots. Why would you sell it for 10k when you can make much more actually running it?

Not to mention that the more people using the same bot, the less edge it has

>> No.4329689

>>4329600
>>4329525
i actually sold about this.

the best outcome would be to make a good bot that makes profit, even small, and then make a paid version which is exactly the same but delayed on opening/closing orders.

that way the more people use it the more you'll ride the wave

>> No.4329703

>>4329600
I dont know, why do people sell stock trading bots?
is it really all that profitable apart from the bot sales business after 10 000 nerds have sunk their teeth in the business

>> No.4329741

>>4329310
Many exchanges allow you to download price history as comma separate values.

EG: http://api.bitcoincharts.com/v1/csv/

>> No.4329980

>>4329363
>But still, I don't get the bashing by everyone. If it works for him?
I guess, however I feel that OP would actually benefit more in his life if he learned something like Go/Rust/Python or even Javascript to do this task.

He obviously has the knowledge to make HTTP requests and database access.

I honestly see PHP as nothing but a ghetto where you have to compete with low tier developers

>> No.4330023

>>4329980
> would actually benefit more in his life if he learned something like Go/Rust/Python or even Javascript to do this task
I agree.