Pages:
Author

Topic: Chrome Browser extension: MtGox trading bot - page 12. (Read 72509 times)

newbie
Activity: 42
Merit: 0
Here's a (very brutal, indeed) fix for everyone having issues with v0 gox apis: v1 work very well indeed!
You need to change the following lines in background.js:


Thanks, I'll have a look at it!
The v0 API is unreliable indeed...
newbie
Activity: 46
Merit: 0
Here's a (very brutal, indeed) fix for everyone having issues with v0 gox apis: v1 work very well indeed!
You need to change the following lines in background.js:

Line 128:
Code:
req.open("GET", url);
becomes (preventing chrome to use cached pages)
Code:
req.open("GET", url+"?sid=" + Math.random());

Line 271:
Code:
var url = "https://data.mtgox.com/api/0/data/getTrades.php?Currency="+currency+"&since="+since;
becomes
Code:
var url = "https://data.mtgox.com/api/1/BTC"+currency+"/trades?since="+since;

Line 283:
Code:
var trs = JSON.parse(req.responseText);
becomes (quite raw, but it works!)
Code:
var trs = JSON.parse(req.responseText.replace("{\"result\":\"success\",\"return\":","").replace("]}","]"));

Line 304:
Code:
url = "https://data.mtgox.com/api/0/data/getTrades.php?Currency="+currency+"&since="+since;
becomes
Code:
url = "https://data.mtgox.com/api/1/BTC"+currency+"/trades?since="+since;

The bot is behaving MUCH better now thanks to the new apis  Cheesy

EDIT: probably the big issue was Chrome using the cached content, which stopped the bot any time it went through an empty page. With the line 128 workaround (above), v0 apis should work well, too!
newbie
Activity: 46
Merit: 0
How about crappy gox apis that get stuck now and then?
For instance,now I only get prices up to 16.25 (it's 16.52 now, interval is 5 min).
If I manually look up the page this bot is trying to reach, i only get empty [] brackets instead of the transactions list.
It has happened before, but having a bot that randomly stops working for half an hour or more at any given time makes it all potentially useless!
What about v1 and v2 apis? I've been told they behave much better.
TobbeLino, any chance you could address this issue? I've seen you've reduced to 1 m the refresh interval in the last commit, so I think it's definitely a problem with v0 apis.
By the way, thank you for the excellent work by far!
newbie
Activity: 28
Merit: 0
You're right. That's just my emotions with the bot - I don't like to loose BTC Smiley I would prefer loosing fiat ...
So I'm going to do something about it.
I m going to make an emotional bet: "BTC will raise in long therm" - and in this case - I would prefer to stay on BTC than sell it too low.
So I think to myself: I'm going to implement an algo which will prevent my stupid bot  from selling bTC lower than they were bought Smiley
How do You think about it ?
newbie
Activity: 42
Merit: 0
It seems to be "unproof" from minimal price fluctuations (like those from 2013-05-09 09:00).

I think it could be improved adding more smart algo to decide if to buy/sell (ie concerning also wallet history)
Did first step in this direction - just pushed mod which gets wallet history and displays it under chart.
Now we can think how to use the data deciding on current trade ... maybe some additional "wait" mode ? (as extention of currrent tradeEnabled flag)

When the market is calm, like yesterday, it's probably better not to trade at all. No bot (or person), regardless how smart they are can make money on a market that stands still. You need a swing (that is larger than the fees).

Also, taking wallet history into account when making buy/sell-decisions sounds wrong for a bot. Because that's exactly what people do when they trade, and that's why we need a bot to keep our feelings AWAY from the decision making Smiley
After all, your personal wallet history or trading history never ever affects the future of the market, and if you think the price will go down you should sell - no matter what you paid, and if you think the market will go up, you should buy, no matter how you have traded before... But for people it's very difficult to keep the emotions away - at least for me Smiley
newbie
Activity: 42
Merit: 0
I want to first thank you for your hard work on your free bot. I am a little confused how it trades. According to your description, it buys and sells based on the "absolute difference between EMA %" and that statement worries me. I thought you would initiate a buy when it's positive difference and a sell when the difference is negative. How does it determine when to buy and sell based off absolute values?

That description is a leftover from the original bot (that didn't have separate buy/sell thresholds).
I'll commit a new version soon with a more correct description.
newbie
Activity: 42
Merit: 0
Wich threshold do you suggest? Are 0.25% (Buy/Sell T) by default, suitable?

Well, I'm no expert in trading, so other people are probably better to help you with that...
I think the optimal threshold setting depends on the sample interval and how "long trends" you try to catch with the bot, and it also depends on how volatile the market is at the moment...

The default 0.25% thresholds and 1 hour sample interval comes from the original bot.
Many seem to prefer to lower the sample interval and lower the thresholds to allow "faster trading".
I can't judge if that's a wise strategy, and I personally think that the biggest problem when trading manually (without a bot) is that you react too quickly and too strong, so the whole point for me using the bot is that it will take it more easy Smiley
Yesterday when the market was very calm without a distinct trend, my bot lost money because the thresholds where too low and the fees where higher than the profit. On a very calm market, it's probably better not to trade at all (by setting the thresholds higher). But as I said, I'm no expert in trading - I just modified the bot, allowing more settings...

newbie
Activity: 28
Merit: 0
It seems to be "unproof" from minimal price fluctuations (like those from 2013-05-09 09:00).

I think it could be improved adding more smart algo to decide if to buy/sell (ie concerning also wallet history)
Did first step in this direction - just pushed mod which gets wallet history and displays it under chart.
Now we can think how to use the data deciding on current trade ... maybe some additional "wait" mode ? (as extention of currrent tradeEnabled flag)
newbie
Activity: 40
Merit: 0
I want to first thank you for your hard work on your free bot. I am a little confused how it trades. According to your description, it buys and sells based on the "absolute difference between EMA %" and that statement worries me. I thought you would initiate a buy when it's positive difference and a sell when the difference is negative. How does it determine when to buy and sell based off absolute values?
legendary
Activity: 2478
Merit: 1362
Wich threshold do you suggest? Are 0.25% (Buy/Sell T) by default, suitable?
sr. member
Activity: 283
Merit: 250
Thank you  Grin

Just released a new version of my (free) trading bot modification: https://github.com/TobbeLino/GoxTradingBotTobli

It now also has a chart!


newbie
Activity: 12
Merit: 0

But today I'll celebrate my birthday Smiley

Happy Birthday Tobbelino!

I played around with it briefly last night and liked what I saw. No official trading just seeing what different options produced.  I hope to use it in the future and hope to see it continually evolve.

-R
newbie
Activity: 42
Merit: 0


- Keep an amount of BTC away from trading


- Can you do the same for fiat ? (usefull to test)

I started implementing that, but it turned out to be a bit tricky.

When making a "buy" with the MtGox API, the bot calls "buyBTC" and specify how many BTC to buy. Or in fact 1000 BTC right now, so in practice it will buy as much as you can afford (if your not filthy rich! Smiley  The bot doesn't know what the exact price will be in fiat before the trade, so it doesn't know how much BTC to buy to keep a certain amount of fiat.

It would however be possible to make an estimate based on last price, but it would not be exact.
But maybe that's ok...
newbie
Activity: 42
Merit: 0
Tobbe

Your modified extension is Ba Dass!

A couple of thoughts:

You should add a space to line 22 of popup.js for the ticks element.

    document.getElementById("ticks").innerHTML=bp.tickCount+ " samples"


And I added a new Ema s/l % metric to the graph tooltip (You won't want to add it like this, it's just a hack):

function formatEMALongTooltip(sp, options, fields){
    var trend='?';
    if (lastEmaTime==fields.x)
        trend=(fields.yUP':(fields.y>lastEmaShort?'DOWN':'none'));

    //
    // Display EMA S/L %. Helpful for gauging on the graph when trades execute on new trend directions.
    // Round to 3 decimal places.
    //
    var per = ((lastEmaShort-fields.y) / ((lastEmaShort+fields.y)/2)) * 100;
    trend = trend + ' ' + Math.abs(Math.round(per*1000)/1000) + '%';

    return ' EMA'+bp.EmaLongPar+': '+formatChartNumbers(fields.y)+'Trend: '+trend;
}

I wanted to see from the chart when trades would be placed having different thresholds....

Cheers.
Jon

Thanks, I'll fix the typo and check your addition!
I've also thought about trying to add some kind of indication in the chart where the trend switches and the bot would trigger a trade.

But today I'll celebrate my birthday Smiley
legendary
Activity: 2478
Merit: 1362


- Keep an amount of BTC away from trading


- Can you do the same for fiat ? (usefull to test)
newbie
Activity: 18
Merit: 0
Tobbe

Your modified extension is Ba Dass!

A couple of thoughts:

You should add a space to line 22 of popup.js for the ticks element.

    document.getElementById("ticks").innerHTML=bp.tickCount+ " samples"


And I added a new Ema s/l % metric to the graph tooltip (You won't want to add it like this, it's just a hack):

function formatEMALongTooltip(sp, options, fields){
    var trend='?';
    if (lastEmaTime==fields.x)
        trend=(fields.yUP':(fields.y>lastEmaShort?'DOWN':'none'));

    //
    // Display EMA S/L %. Helpful for gauging on the graph when trades execute on new trend directions.
    // Round to 3 decimal places.
    //
    var per = ((lastEmaShort-fields.y) / ((lastEmaShort+fields.y)/2)) * 100;
    trend = trend + ' ' + Math.abs(Math.round(per*1000)/1000) + '%';

    return ' EMA'+bp.EmaLongPar+': '+formatChartNumbers(fields.y)+'Trend: '+trend;
}

I wanted to see from the chart when trades would be placed having different thresholds....

Cheers.
Jon
member
Activity: 74
Merit: 10
Ohhh, you're right!
I didn't get all the files in the commit!
It's fixed now - thank's for telling me!

No pb, glad to see i'm not completely crazy Smiley Nice use of Sparkline btw.
newbie
Activity: 42
Merit: 0
Yeah, but where? Smiley
I just upgraded and i don't see it...

There's an icon in the popup-window (in the upper right corner)!

Sorry but i don't see it... are you sure you've commit the right files? i only see the sparkline & jquery js, and 2 png in your last commit, but no other files such as popup.html or popup.js

Also, small typo in the popup.html:
Buy threshold: Sell threshold= instead of Buy threshold: Sell threshold:

hope this helps, and thanks for all your work!

Ohhh, you're right!
I didn't get all the files in the commit!
It's fixed now - thank's for telling me!
newbie
Activity: 28
Merit: 0
I've just pushed some changes to my version (chart with trends, buy/sell thresholds etc).
The version is experimental one - however offset works fine - so Your BTC should be safe if You properly configure the bot.

You might consider doing versions for other exchanges that has  APIs e.g. bitstamp - probably minimal code changes for a potentially much bigger market

Yeah I know - also the api used in the bot is version 0 (obsolete one).
It would be good to separate the API handler functions and make it plugin-like Smiley
Anyone interested ? - Make a fork and do some work Smiley

I'm currently thinking on simulations
like that:

https://bitcointalksearch.org/topic/m.2073504
member
Activity: 74
Merit: 10
Just released a new version of my (free) trading bot modification: https://github.com/TobbeLino/GoxTradingBotTobli

It now also has a chart!

Yeah, but where? Smiley
I just upgraded and i don't see it...

There's an icon in the popup-window (in the upper right corner)!

Sorry but i don't see it... are you sure you've commit the right files? i only see the sparkline & jquery js, and 2 png in your last commit, but no other files such as popup.html or popup.js

Also, small typo in the popup.html:
Buy threshold: Sell threshold= instead of Buy threshold: Sell threshold:

hope this helps, and thanks for all your work!
Pages:
Jump to: