Bitcoin Forum
June 24, 2024, 06:09:55 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 [2] 3 4 »
21  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 19, 2013, 10:57:55 AM
We have just updated out EMA bot to Version 1.1, which solves a lot of the issues discussed on this thread. An explanation of new features below with accompanying pictures Smiley.

Get it at: www.btcbots.com
Thread: https://bitcointalk.org/index.php?topic=197175.msg2051530#msg2051530

Features:

1. GREATLY improved stability regarding Mt.Gox lag and API issues. Don't watch your bot crash when Mt.Gox is on the Fritz!
2. Support for EURO trading!
3. Trailing stop loss! Get out when you want to get out, no need for EMA value adjustments, just set stop loss and stop worrying!
4. Completely redesigned interface!
5. Bot can now accept NEGATIVE THRESHOLDS!
6. Graph interface included in options menu to help with bot trading value adjustments.
7.. EMA Lines added to the Graph.
8. Option to disable trading temporarily without having to shut the bot down.
9. 2 Day graph in main interface.
10. Same UNLIMITED world class tech support included for the installation and initial operation phase of your bot. More upgrades coming soon.

11. And best of all, it's a FREE upgrade for existing customers! and you can still use coupon code TB0874 for 10% OFF instantly!


Can I ask a few questions about your trailing stop-loss (which is a very nice feature indeed!)
Is your bot constantly monitoring ALL trades (to adjust the stop-loss trigger price) in real time (to be able to sell if the price suddenly drops between sample points)? Or is the stop-loss function simply monitoring the first trade of every interval? I.e. will your bot react and trigger a sale immediately if the price drops at some time between two samples? (a proper trailing stop-loss should react immediately as it's a safety feature to prevent loss when the price is dropping quickly).

And as your stop-loss logic may often collide with your EMA-bot strategy, how does your bot combine the stop-loss logic with the EMA-bot strategy?  I.e. if he stop-loss triggers a sale, but the EMA-strategy still detects an up-trend, what will happen? Will the EMA-logic be disabled? Because your bot can't start buying again, the minute after after a stop-loss sale, right?

And one final question about the charts you are using.
You DO have permission from bitcoincharts.com and pay a licensing fee to them for embedding/hotlinking their charts in your commercial product, right?
22  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 17, 2013, 11:24:16 AM
It's probably just a temporary MtGox access problem - unfortunately it happens from time to time - MtGox API isn't very stable :/   (you cannot get data from the URL https://data.mtgox.com/api/2/BTCUSD/money/info by loading it directly in the browser, as your API key has to be included in the header)

Right now, MtGox access works for me - have you tried restarting the extension? (or the whole browser)
Yes, over the past three days I restarted Chrome and reloaded the extension several times. I even spun up an EC2 instance just to be sure it wasn't some weird config issue on my computer... but I always got the same message in the bot. I'd read elsewhere that MtGox's API wasn't very stable so at first I assumed that was the problem, but when it persisted after a day I thought I might have set something wrong.

But you must have some Gox Voodoo because now that you've posted, there's no problem Smiley Thanks for replying!

MtGox has been very unstable the last days... Probably new DDoS-attacks against them :/
23  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 17, 2013, 08:54:44 AM
I'm having an issue with TobbeLino's GoxTradingBotTobli. I sent a PM but then read in the previous page that he'd probably be away for a while for parenting duties.

Using the latest files from GitHub, I've created an API Key with the two permissions stated in the readme and I've set the API Key and secret in the bot's configuration. Upon loading Chrome, I receive an error on the bot:
Quote
"Problem accessing MtGox account."

I opened the console and can see this:
Quote
2013-05-16 11:25:50 [background.js:580] Using MtGox API v2
Failed to load resource: the server responded with a status of 503 (OK)

The second line has a URL: https://data.mtgox.com/api/2/BTCUSD/money/info
The URL contains the following text:
Quote
{"result":"error","error":"Identification required to access private API","token":"login_error_missing_rest_key"}

I'm not sure what's required to correct this problem. I've double-checked my API Key, and even created a new API Key/Secret - but the problem persists. Any ideas?

It's probably just a temporary MtGox access problem - unfortunately it happens from time to time - MtGox API isn't very stable :/   (you cannot get data from the URL https://data.mtgox.com/api/2/BTCUSD/money/info by loading it directly in the browser, as your API key has to be included in the header)

Right now, MtGox access works for me - have you tried restarting the extension? (or the whole browser)
24  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 16, 2013, 07:48:44 AM
Any idea why bot sometimes connect to my account at mtGox sometimes not? Sometime I see connection then don't then I see it again...

EDIT: I have 30 minutes delay in my numbers. Interval is 15 minutes and I see price dropping but on mt.Gox is going up now for about 30 minutes. Or is this EMA effect?
I think mtgox goes down when ever theres a large movement, which is exactly when you dont want it to. I hope someone can code this for btc-e, much more reliable and the lower fees make it much more suitable for this type of trading.

Yes, MtGox is quite frustrating :/
I just took a quick look at the btc-e API (https://btc-e.com/api/documentation), and the main functions are there. But I can spot one problem right away: You don't seem to be able to place trades at "market price" using their API. So the bot would have to specify a price, which means that there's big risk that orders will not go through...

Anyone know how to deal with that?
What would happen if the bot would place an order with an extreme price?
E.g. when selling, it could try to sell with the price $1 and btc-e will sell at the highest bid?
And when buying, if the bot specifies $10,000, it will start buying at the lowest price asked?
Can we trust that and not end up buying/selling at crazy rates?
25  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 15, 2013, 06:29:33 PM
Thanks a lot for this great tool.

Due to the last MtGox/Dwolla news. Have you considered the idea of including other bitcoin exchanges like btc-e or bitstamp just in case?

Maybe in the future. I don't know what APIs they offer...
But at the moment I don't have very much time to develop (my wife and I are having our second child any day now, so expect me to "disappear" from here for a while any day Smiley
26  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 15, 2013, 06:25:09 PM
@TobbeLino:

Minor bug found. Graphs shown wrong interval after changing "Show last". Restart and wait 12 hours didn't help.



Thanx for your work!



UPD: Reinstall helps..  Sad  on every changing "Show last"
  

Yes, the graph currently always shows all fetched 144 samples... The "show last" only affects the list at the moment... I'll make the graph follow this setting as well...
27  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 14, 2013, 11:16:04 PM
I'm using way different settings and and it working well for me.
I haven't made big bucks but in this recent drop my settings are dampening out the noise while still catching the big movements.

You will have to do some analysis using bitcoincharts.com to see what you would like this bot to do for you.

I feel the default settings are way to aggressive...I have mine tuned way down to only grab the big corrections.

Tune the EMA's and the % to what's been happening the last month, not the last few days.

I think that's is a very wise advice!
Many seem to use way too aggressive settings, and loses.
You simply can't make good trades every day - if there IS no trend, the bot can't find one! Smiley
28  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 14, 2013, 01:31:03 PM
I just released a new version (v0.2.1.6) of the bot that uses MtGox API v2 by default.
(MtGox still seems to have problems today delivering user data with the old API v0)

It also includes a lot of improvements on caching trade data, so loading and changing sample intervals will be as fast and efficient as possible with the current MtGox API (every sample that can be useful from every call is cached in local storage).

Download here: https://github.com/TobbeLino/GoxTradingBotTobli

Pleas report any problems with trading, etc with the new API!
It is not as extensively tested as API v0...
29  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 14, 2013, 12:10:44 PM
It says "Problem Accessing MtGox Info" since MtGox has problems. Has any of you the bot disabled with this message?


EDIT: Changed to const useAPIv2=true; and now is working fine again.

Yes API v0 seems unstable at the moment. Maybe it's time to switch to API v2 by default.
Have your bots done any trading etc with API v2 and everything looks correct?
I haven't tested with API v2 very much myself (although it "should work") Smiley


It has not crossed down since yesterday i posted the message. Hope it works. Do you plan to include better support for Api2?

If the constant "useAPIv2" is set to "true", the bot is using the equivalent API v2 for all calls, so it's fully supported already.
But I haven't looked into it more - maybe there are some new API v2 calls that could make the bot better/more effective.
But the API v2 is quite poorly documented, and for the features currently implemented in he bot, I have not seen any major improvements in API v2 (other than it seems to be a bit more reliable when MtGox is under DDoS-attacks or having other problems).

I'm currently working on improved caching and faster and more effective loading of trade data, without having to be hammering MtGox with calls.
30  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 14, 2013, 08:17:08 AM
I'm just wondering, but is there a reason that buying BTC with this bot is limited to 1000 of whatever currency in the code? (Lines 216 and 218 in background.js)

When buying, the bot tries to buy 1000 BTC (regardless of currency).
This will result in buying "as much as possible" and spending all funds.
...unless you have more than the equivalent of ~$118,000 with today's price on your account of course, but I don't think anyone with that much funds would let a bot play with it Smiley
31  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 14, 2013, 06:05:38 AM
It says "Problem Accessing MtGox Info" since MtGox has problems. Has any of you the bot disabled with this message?


EDIT: Changed to const useAPIv2=true; and now is working fine again.

Yes API v0 seems unstable at the moment. Maybe it's time to switch to API v2 by default.
Have your bots done any trading etc with API v2 and everything looks correct?
I haven't tested with API v2 very much myself (although it "should work") Smiley
32  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 12, 2013, 11:23:39 PM

I think that is a great idea. But I'm worried about the amount of samples taking too long. Usually when there is a trend it spikes very quickly and can gain a couple dollars within the hour or two you waited for the samples. The same could be for selling. You see the lines go down and you figure you want to sell as quickly as possible but now you want to wait another hour or 2 to see if it's really going down. More often than not it declines very rapidly and spikes up a little and then back down. I try to buy in when there is a clear trend and get out as soon as it looks bad. I guess this is a way to play it safe for the long term but I was wondering what your thoughts are.

I think you misunderstand a bit how a bot works. A bot will never "buy at the bottom and sell at the top". It will always wait and see if the trends seems solid. That's just how it's supposed to work, and that's why it is often (but not always) more successful than myself trading manually Smiley  If you try to buy at the very bottom of a swing, and sell at the very top, you will have to take way to high risks all the time, and you will very often find yourself out of synch with the trends (because you bought or sold to early, thinking you where at the bottom/top), and you start losing...
33  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 12, 2013, 11:11:51 PM
In my opinion, the volatility check wouldn't have let the bot buy btcs in the first place, thus it wouldn't have sold at a loss: what we've been experiencing for the last days were strong price raises which weren't supported by the market itself for the following hours (letting the price fall again).
By checking for AT LEAST two intervals that the volatility is above the threshold, your situation could be avoided (the sample immediately after the price explosion would have had a low volume, not allowing the bot to buy).

Since this is turning into community-driven development, I think that strategy-based commits should be done one at a time, evaluating each time which improvents can be done, and how. (this is because, IMHO, stop-loss strategy would be redundant w/ volatility check, but I could be proven wrong easily once everybody gets the volume-check version)

Are you confusing volatility with volume?
That's two very different things...
And the function of a stop-loss can't be replaced by volatility- or volume checks
34  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 12, 2013, 11:07:52 PM
eduk, I've noticed you happen to know how far fible1's paid version has developed. As per 2 days ago, Tobbelino's one was much better (not to mention, free). This volatility check addition is a must-have, and I saw it was implemented in fible1's version, too. Any clue on how it performed? Is tobli's version always the best one?

Here is the volatility one I made yesterday https://bitcointalk.org/index.php?topic=67591.msg2122016#msg2122016 which is free because most of it is other peoples work as it is TobbeLino's version with a volatility check, I'm still testing though, I literally finished coding the modification last night and have only run it for about 10 hours today. But it is avoiding sells and buys.

I'm also figuring out other ways to make it smarter, as during stable periods like we've seen these last few days it an be too agressive.


Is there anyway to avoid having the bot sell at a loss? I was on the unfortunate end of my bot buying at the top and selling at the bottom and would of rather saved those coins. Or is it simply better to have the bot do its thing and eventually come out on top?

I think the philosofy with bots is that they "win some and lose some", but if tuned, they should win more than they lose and make a steady profit in the long run. But the last days have been hard for the bots or any swing trader - the market is too clam, low volumes and no swing to trade on...

I think (my opinion of course) that it would be very risky to "forbid" a bot to sell at a loss. Becuase then you have already decided that the market eventually "must" go up above what you paid. But this may never happen, or may take a very long time, and the bot can't trade while you wait for the market to recover (if you had a bot like that running when the market dove from $250 last month, it would not have sold if it made any trades near the peak, and it would now be sitting here, waiting, waiting for the market to reach ~$250 again).  The only thing that matters is: where will the price go from now? If up: buy/keep! If down: sell/stay out - no matter what you paid or how you traded "yesterday". Even if it sells at a loss, it's no point in follow the trend down, losing even more. Better to sell and buy later and follow the trend up again.
35  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 12, 2013, 10:45:14 PM
Hi all, I'm new to Bitcointalk been waiting hours to get out of newbie mode to post this. Yesterday I spent quite a long times learning the inner workings of this bot, I took TobbeLino's version and have made some modifications to attempt to start making the bot a bit smarter.

I have added some volatility data with a volatility buy threshold/sell threshold that must also be passed before a trade is executed.

The volatility data is worked out by taking X amount of samples (which you can set in options) and then finding the lowest and highest sample from within them. The lowest is then taken away from the highest to give the difference. This volatility score is the added to the volatility score from a couple of samples ago and divided by 2 to smooth it out slightly.

Whether this is the best way of working out volatility, I'm not sure. I found this true range and average true range from this link and basically simplified it http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:average_true_range_atr

So if anyone has any ideas how to improve this volatility score, just let me know.

Also please test it with small amounts as I've only been using it for 5 minute samples so far, there have also been some changes to the section which determines whether to execute a trade and so use at your own risk. I used this morning and it made a sell at 11:40 BST as in image below.



Options have been added to set it up. I'm liking the look of 3 volatility samples with about a 0.9 to 1.2 threshold on each. I believe that this volatility check will  also allow you to lower the main buy sell thresholds.

Download: https://mega.co.nz/#!k9EERBpI!fr0EdklaQIZPyfVqF7C-aRYeBRwkqc0bdzbitz4Xho4
(Copy/Paste this as forum screwed it up)

As a bonus I have also added a sound notification so that when a trade gets made you can hear it happening.

@TobbeLino, if you like this update, feel free to add to it to your GitHub / improve upon it or contact me.

Thanks! I'll have to think about this before adding it to my bot...
My spontaneous reaction is that this seems to a over-simplistic way to get a volatility indicator (but I'm no expert in this), so it will not be very reliable. Each sample is only ONE single trade on ONE point in time, so you are only looking at three trades (out of all hundreds or thousands that take place during an interval).  Maybe for very short intervals you could get some useful data if you're lucky, but with trading intervals of 30 minutes or more (or even 15 minutes) I'm think that your volatility indicatior will not reflect the true volatility.

Personally, I'm also a bit sceptical about using volatility as an indicator at all (at least in this way).
I'd much rather use a volume indicator. But to implement that, the bot needs to fetch a whole different kind of data (total volume between sample intervals for instance).

I see mostly "Jr. Members" (including me) commenting and suggesting features for the bot - are there anyone who actually know the theories here? Unfortunately I think that MtGox APIs (which are not very good in my opinion) will probably limit how complex indicators this bot can calculate.

In general, I think that there seems to be some misconceptions of what to expect from a trading bot.
A bot is not a "magic money making machine" Smiley
Any bot (or human) will make bad trades sometimes - no matter how "smart" it is.
But the goal is that it should be able to make more good trades than bad trades, and that it will make money, slowly, steadily in the long run.  And I don't think it's possible to just "speed up" the process and make more money in shorter time, simply by setting a shorter sample interval - the trading fees will probably take all your profit away.

But as I've said before: I'm better at programming and software development that at trading - thats why I need a bot! Smiley
So if there are any true experts here with real experience with designing trading bot strategies, please feel free to comment!
36  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 11, 2013, 12:38:23 PM
But the problem with fetching historical trade data at given points in time with MtGox API is that the bot only wants ONE trade (the first one) from each chunk of trades. The rest of the data is usually not relevant since we need samples at the correct points in time (if the sample interval is very short, there COULD be more than one useful trade in the chunk, but in most cases there are probably more than 1000 trades between each sample time, so only the first trade is useful. So in most cases we have to make one call for each sample). If there was a way to specify how many trades to fetch with each call, I would set it to 1, but as far as I know that's not possible with any API version...

But caching data should cure some of the problem. Then you could at least restart the bot/browser without a new storm of calls to MtGox. But as you said, it's probably ok - while developing, I need to restart the bot all the time, causing 144 calls to be made, and I don't think I've been blocked...

Good point. But if the bot expects each request to be roughly equivalent to one sample and uses only one price from each request (looks like it uses the opening price of each sample), that seems like a pretty rigid and ineffective way to go. It seems to expect each reply to be equivalent to a sample size.

So maybe instead of making n requests and pick the opening price from each, it would be more effective to use all those trades to build your own candles from it? Take a look at goxtool's slot_fullhistory() and OHLCV() functions here https://github.com/prof7bit/goxtool/blob/master/goxapi.py as this is pretty much the way it does it, building its own Open-High-Low-Close-Volume candles from all the fetched history. That could give you a relative independence from MtGox's response size since you'd be fetching for a total history duration rather than making a precise number of requests in which only one price is picked from each. Does that make sense?

The API's the bot currently uses allow it to specify from which time we want the chunk, so the first trade in each reply is always "on time". But we can't specify how big the chunk should be (in our case we only need it to be 1 trade).
37  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 11, 2013, 11:15:33 AM

I see. I completely agree that the history size should be at least 144 x the sample size, but what i meant is that since you're getting 10x as much data for each request when using the API v2, you probably don't need to fetch as many times as the original bot did when using the API v0. In that regard, obtaining 144 samples' worth of data does not necessarily mean having to make 144 requests to the API.

In my experience, the MtGox API is more defensive against the time between each request (hammering will get you banned for a while) than to the actual number of requests itself. In the case of the bot, i think the time it takes to parse the json and fetch the next request should be enough timeout. You could always add a small timeout in between requests if i'm wrong, but since it seems to work as-it-is now, i think you should be okay with an even smaller number of requests for the same amount of data.

But the problem with fetching historical trade data at given points in time with MtGox API is that the bot only wants ONE trade (the first one) from each chunk of trades. The rest of the data is usually not relevant since we need samples at the correct points in time (if the sample interval is very short, there COULD be more than one useful trade in the chunk, but in most cases there are probably more than 1000 trades between each sample time, so only the first trade is useful. So in most cases we have to make one call for each sample). If there was a way to specify how many trades to fetch with each call, I would set it to 1, but as far as I know that's not possible with any API version...

But caching data should cure some of the problem. Then you could at least restart the bot/browser without a new storm of calls to MtGox. But as you said, it's probably ok - while developing, I need to restart the bot all the time, causing 144 calls to be made, and I don't think I've been blocked...
38  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 11, 2013, 09:48:50 AM
Yes, the bot uses the "since"-parameter, and it will make one fetch for each sample interval back in time to calculate EMA. Total 144 calls when starting the bot or changing sample interval (EMA-values need to be recalculated). This many calls may be a problem in itself since I think MtGox's (or Couldflare's) DDoS-protection might kick in and block your IP when making so many calls in a short time.

But the problem with API v1 and v2 is that it seems that the size of the chunks has been increased from 100 to 1000.

For instance: https://data.mtgox.com/api/2/BTCUSD/money/trades/fetch?since=1354250571691361 will return 1000 trades
And: https://data.mtgox.com/api/0/data/getTrades.php?Currency=USD&since=1354250571691361 will return 100.

I've taken a quick look at the code, and a few things come to mind. First, that 144 is pretty arbitrary: since EMA is a recursive calculation, its accuracy is very dependent on the number of samples. After a certain point it becomes less relevant since the further you go back, the less the weight given to the data, but 200 * whatever timeframe you're trading is a generally accepted sample size. I remember someone complaining that the initial sample size was not accurate enough so Piotr increased it to 144 which should be an ok compromise, but it won't hurt if you have more.

So you could either keep making these 144 requests of 1000 trades and then divide that by your trading sample size, which would give you about 10 times more candles to back your calculations on, or you can make that 144 dynamic by making requests with a timestamp equal to (number of samples required for accuracy x trading sample size) instead of this fixed 144. In other words, fetch only as much as you need according to your sample size instead of making an arbitrary number of requests. This fixed value made sense when the original bot only dealt with H1 trading and needed 144H of backdata, but not so much now that you allow users to define the trading candle size.

Also, this history and its subsequent updated candles should probably be cached into localstorage until next launch. Since for a 60m candle you're fetching about 5 days worth of history, chances are that some of that data will still be valid on next bot launch, and that would also prevent from refetching everything upon a simple change of parameters.

Yes, 144 is from the original bot, and I have not dared to change or question it Smiley
However, I think the number of samples should be the same no matter what the sample interval is (the bot fetches 144 samples, not 144 hours of samples). The EMA-vaules are calculated from the samples - independent of the interval, so the accuracy should be exactly the same as the original bot for any sample interval.

Caching samples would probably be a good idea!
Because calling the MtGox API repeatedly in a short time could mabe get you blocked by their DDoS-protection...
39  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 10, 2013, 09:53:30 PM
Hmmm - I just got API v2 working here BUT there's a bit of a problem fetching trades with API v1 and API v2 - MtGox will return 1000 trades instead of 100 (with API 0), so the data traffic will increase 10-fold (and it will update a lot slower!) :/
Unfortunately there doesn't seem to be any parameter to specify how many trades we want to fetch (we only need ONE sample for each interval!) The docs for API v2 is quite limited however - anyone know if there's a way to fetch single historical trades using API v2?

The reason it's replying with a lot of trades is that in API v2, it will return the last 24h history by default if you don't specify anything and just fetch /money/trades

You can add a ?since= parameter at the end of the url to have it return only trades since that order id. Also, if you do that it'll then reply in chunks of 100 trades like you want.

To quote this post https://bitcointalk.org/index.php?topic=150786.msg1690500#msg1690500

since is in time units*1000000
to start x hours ago you can calculate
   since = int(time() - x*60*60)*1000000
   url = "http://data.mtgox.com/api/1/BTCUSD/trades?since=" + str(since)

You will get batches of 100 trades, so you need to keep calling
with since set to highest tid in previous batch

Hope this helps.

Yes, the bot uses the "since"-parameter, and it will make one fetch for each sample interval back in time to calculate EMA. Total 144 calls when starting the bot or changing sample interval (EMA-values need to be recalculated). This many calls may be a problem in itself since I think MtGox's (or Couldflare's) DDoS-protection might kick in and block your IP when making so many calls in a short time.

But the problem with API v1 and v2 is that it seems that the size of the chunks has been increased from 100 to 1000.

For instance: https://data.mtgox.com/api/2/BTCUSD/money/trades/fetch?since=1354250571691361 will return 1000 trades
And: https://data.mtgox.com/api/0/data/getTrades.php?Currency=USD&since=1354250571691361 will return 100.


40  Economy / Trading Discussion / Re: Chrome Browser extension: MtGox trading bot on: May 10, 2013, 08:40:31 PM
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!


Hmmm - I just got API v2 working here BUT there's a bit of a problem fetching trades with API v1 and API v2 - MtGox will return 1000 trades instead of 100 (with API 0), so the data traffic will increase 10-fold (and it will update a lot slower!) :/
Unfortunately there doesn't seem to be any parameter to specify how many trades we want to fetch (we only need ONE sample for each interval!) The docs for API v2 is quite limited however - anyone know if there's a way to fetch single historical trades using API v2?
Pages: « 1 [2] 3 4 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!