Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: marcus03 on January 21, 2014, 06:45:30 PM



Title: Bter API problem
Post by: marcus03 on January 21, 2014, 06:45:30 PM
Hi!

I' am implementing charting in my application for NXT prices and trying to retrieve the NXT trades at Bter through:

http://bter.com/api/1/trade/nxt_btc/3603233

Two out of three times I get

'<html><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head><iframe src="/_Incapsula_Resource?CWUDNSAI=9&incident_id=104000570172938530-2564557266307515286&edet=12&cinfo=2e3bde81c753866a08000000" frameborder=0 width="100%" height="100%" marginheight="0px" marginwidth="0px">Request unsuccessful. Incapsula incident ID: 104000570172938530-2564557266307515286</iframe></html>'

which shows a captcha input page.

Is the Bter API not for bots? Which humans read json data?

Is there a way around this?

Thanks!
Marcus


Title: Re: Bter API problem
Post by: pmconrad on January 21, 2014, 09:32:57 PM
The Bter trade API has been broken for over a month now.


Title: Re: Bter API problem
Post by: xchrix on January 22, 2014, 12:11:14 PM
i am trying to get the funds trough the private API. its also broken
data.bter.com is completely wrong
whats going on with bter? :)


Title: Re: Bter API problem
Post by: marcus03 on January 22, 2014, 12:52:44 PM
i am trying to get the funds trough the private API. its also broken
data.bter.com is completely wrong
whats going on with bter? :)

Use bter.com without the "data.". Still, kind of buggy.


Title: Re: Bter API problem
Post by: borzalom on January 22, 2014, 08:37:04 PM
For the last two days all private API query has wrong result. ( Incapsula incident ID: ... ) I use same program, same IP, same method. I tried change API keys and tried use other user account and other IP too. I got the same result always. I wrote letter to support of bter in two days ago. I asked what i do ? And of course this letter remained unanswered.  Bter API died. :-(


Title: Re: Bter API problem
Post by: marcus03 on January 22, 2014, 08:38:45 PM
For the last two days all private API query has wrong result. ( Incapsula incident ID: ... ) I use same program, same IP, same method. I tried change API keys and tried use other user account and other IP too. I got the same result always. I wrote letter to support of bter in two days ago. I asked what i do ? And of course this letter remained unanswered.  Bter API died. :-(


Brute force kind of works... Repeat request up to ten times until you have a result which has no "<HEAD>". Not nice play, but ya know...


Title: Re: Bter API problem
Post by: borzalom on January 22, 2014, 08:57:50 PM
Not work this method. :-( Simple API queries like history ( bter.com/api/1/trade/btc_cny ) usually working good but private api queries always have same wrong result. I tried up to 20 times but not good. Getfunds query example working for you ? ( bter.com/api/1/private/getfunds )


Title: Re: Bter API problem
Post by: jsCoin on January 23, 2014, 11:13:12 PM
Glad its not just me.  I just started implementing Bter and public calls work just fine but when testing private calls I was racking my brain trying to find what was wrong with my code.  Doesn't look good with support not responding though.  Has Bter entered zombie mode?


Title: Re: Bter API problem
Post by: xchrix on January 24, 2014, 07:38:40 AM
what shall we do about this? writing emails to bter support is a bad idea because they never answer :D


Title: Re: Bter API problem
Post by: borzalom on January 24, 2014, 08:29:12 AM
Glad its not just me.  I just started implementing Bter and public calls work just fine but when testing private calls I was racking my brain trying to find what was wrong with my code.  Doesn't look good with support not responding though.  Has Bter entered zombie mode?

Don't trying to find bugs with your code. Your code are probably correct. Example code of bter is good. That code worked me lot of previous days. Now not. ( public api calls work, private api cals don't work )


Title: Re: Bter API problem
Post by: borzalom on January 24, 2014, 12:47:13 PM
Bter fixed problem. All API ( private too ) queries work again successfully. Now good everything.  I hope will work for a long time.


Title: Re: Bter API problem
Post by: Int32 on January 28, 2014, 07:00:40 PM
wow... incomprehensible! :D
it's working for me too... with the same code :)

but one question:
i will place a doge_btc order with a rate of "0.00000268" ... webrequest is okay, but in my account i see only 6 decimal places: "0.000003"?

don't know what to do :/


Title: Re: Bter API problem
Post by: borzalom on January 29, 2014, 09:31:11 AM
wow... incomprehensible! :D
it's working for me too... with the same code :)

but one question:
i will place a doge_btc order with a rate of "0.00000268" ... webrequest is okay, but in my account i see only 6 decimal places: "0.000003"?

don't know what to do :/

Always rounded values ​​displayed on the website, but the calculations use the floated value.


Title: Re: Bter API problem
Post by: jondecker76 on February 02, 2014, 06:19:04 PM
I found a few other problems with the Bter API today

1) in the json result, a result of true is as expected ("result":true), but false results have quotes around the "false", making the json_decode treat it as a string ("response":"false").  This makes for undesired behavior, as the string "false" can evaluate as true.

2) The order_id returned by  https://bter.com/api/1/private/placeorder is incorrect.  I just tried this a few times today, and the order_id returned is not even close to the actual order ID which gets assigned (off by over 7,000,000).

I have emailed Bter support about it, but of course I don't expect a response from such a shoddy operation.


Title: Re: Bter API problem
Post by: borzalom on February 06, 2014, 02:39:38 PM
I found a few other problems with the Bter API today

1) in the json result, a result of true is as expected ("result":true), but false results have quotes around the "false", making the json_decode treat it as a string ("response":"false").  This makes for undesired behavior, as the string "false" can evaluate as true.

2) The order_id returned by  https://bter.com/api/1/private/placeorder is incorrect.  I just tried this a few times today, and the order_id returned is not even close to the actual order ID which gets assigned (off by over 7,000,000).

I have emailed Bter support about it, but of course I don't expect a response from such a shoddy operation.

Bter API "documentation":
Notice: The returned order_id is meaningless, please use this API https://bter.com/api/1/private/orderlist to obtain all your open order IDs


Title: Re: Bter API problem
Post by: 305115334 on February 17, 2014, 02:10:22 AM
I use java to access the Restful bter api, the public info can be reached. Once tried private api, it returns "..".
I dont know what is wrong. Maybe sign and key are not matched.
Could u give me a privelege authentication example written in java? Thanks!


Title: Re: Bter API problem
Post by: borzalom on February 19, 2014, 08:36:37 PM
I use java to access the Restful bter api, the public info can be reached. Once tried private api, it returns "..".
I dont know what is wrong. Maybe sign and key are not matched.
Could u give me a privelege authentication example written in java? Thanks!

You must sign the post data. ( see php example code of bter api documentation )
PHP example code work good. Try it your sign keys.

php:
$sign = hash_hmac('sha512', $post_data, $secret);

java:
            byte[] bytesKey = ....
            final SecretKeySpec secretKey = new SecretKeySpec( bytesKey, "HmacSHA512" );
            mac = Mac.getInstance( "HmacSHA512" );
            mac.init( secretKey );
            final byte[] macData = mac.doFinal( datas.getBytes( ) );
            byte[] hex = new Hex( ).encode( macData );
            result = new String( hex, "ISO-8859-1" );


Title: Re: Bter API problem
Post by: 305115334 on February 20, 2014, 05:07:09 AM
I have signed the post data.
URL getUrl = new URL("https://bter.com/api/1/private/orderlist");
      HttpURLConnection aConnection = (HttpURLConnection) getUrl
            .openConnection();
      Map<String, String> data = new HashMap<String, String>();
      // data.put("dad", "fff");
      // data.put("order_id", "fff");
      data.put("nonce", String.valueOf(System.currentTimeMillis()));
      String postdata = httpBuildQuery(data);
      String sign = generateHMAC(postdata);
      aConnection.setRequestMethod("POST");
      //aConnection.setDoOutput(true);
      aConnection.setRequestProperty("Key",
            "*************");
      aConnection.setRequestProperty("Sign", sign.replaceAll("\n", ""));
      
      aConnection.connect();
      BufferedReader reader = new BufferedReader(new InputStreamReader(
            aConnection.getInputStream(), "utf-8"));

I dont know what is wrong.
   private static String httpBuildQuery(Map<String, String> data)
         throws UnsupportedEncodingException {
         String result = new String();
           for (String hashkey : data.keySet()) {
               if (result.length() > 0) result += '&';
               try {
                   result += URLEncoder.encode(hashkey, "UTF-8") + "="
                           + URLEncoder.encode(data.get(hashkey), "UTF-8");
               } catch (Exception ex) {
                   // Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
               }
           }
           return result;
   }


Title: Re: Bter API problem
Post by: 305115334 on February 20, 2014, 05:14:56 AM
private static String generateHMAC(String datas) {

      // final Charset asciiCs = Charset.forName( "utf-8" );
      Mac mac;
      String result = "";
      try {

         SecretKeySpec secretKey;

         try {
            secretKey = new SecretKeySpec(
                  (new BASE64Decoder()).decodeBuffer("**************************************"),
                  "HmacSHA512");
            mac = Mac.getInstance("HmacSHA512");
            mac.init(secretKey);
            final byte[] macData = mac.doFinal(datas.getBytes());
            result = (new BASE64Encoder()).encode(macData);
            
         } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
         }

         

      } catch (final NoSuchAlgorithmException e) {

      } catch (final InvalidKeyException e) {

      }
      return result;

   }


Title: Re: Bter API problem
Post by: 305115334 on February 20, 2014, 05:24:07 AM
{"result":"false","message":"Error: invalid data"}  This is the above return result.


Title: Re: Bter API problem
Post by: elmust on February 20, 2014, 06:43:24 AM
Too much problem when use bter api


Title: Re: Bter API problem
Post by: cap1 on February 27, 2014, 02:47:22 PM
I have wasted days on this API.

Sitting trying to work out the issues. Using the PHP example is okay but using JavaScript from node just does not work.

Glad I found this forum post as I thought I was going mad. I have tried every method over the past 3 days to get private responses but just get {"result":"false","message":"Error: invalid key or sign"} (no matter what is signed here using Crypto just doesn't resolve) and {"result":"false","message":"Error: invalid data"}

Even looking http://www.cryptocoincharts.info/v2/tools/bter_balances where they have a private JS fund checker, this does not work and responds 500 Internal Server Error

All my API calls for tickers work fine but private key calls just don't. Damn you BTER i'll never get that time back.


Title: Re: Bter API problem
Post by: borzalom on February 28, 2014, 08:24:10 PM
{"result":"false","message":"Error: invalid data"}  This is the above return result.

Repeat request. Send query over and over while you get good result.


Title: Re: Bter API problem
Post by: xchrix on February 28, 2014, 09:34:32 PM
bter API is just very unstable. i dont know what they are doing all the time :D


Title: Re: Bter API problem
Post by: sava0123 on March 28, 2014, 10:04:07 AM
Hi guys! I keep getting this message after using my code and bter API to place order:

{"result":true,"msg":"Success","order_id":12332706}

Then I using this link ('https://bter.com/api/1/private/orderlist') for check my orders and got this one:

{"result":true,"orders":[],"msg":"Success"}

And there is no open order at my account though. (I was checking through the site)

Has someone faced with the same problem? Thanks in advance!


Title: Re: Bter API problem
Post by: pmconrad on March 28, 2014, 01:52:16 PM
Bter API "documentation":
Notice: The returned order_id is meaningless, please use this API https://bter.com/api/1/private/orderlist to obtain all your open order IDs

perhaps your order has already been filled?


Title: Re: Bter API problem
Post by: sava0123 on March 28, 2014, 04:35:14 PM
Bter API "documentation":
Notice: The returned order_id is meaningless, please use this API https://bter.com/api/1/private/orderlist to obtain all your open order IDs

perhaps your order has already been filled?

No. Balance stay the same


Title: Re: Bter API problem
Post by: jettico on April 03, 2014, 04:25:51 AM
I observe some very strange behaviour: my balance (as reported by getFunds call) jumps from one (correct) value to another (incorrect) value approximately once per minute, although no trading activity is in place:

2014-04-03 11:02:04 bter:    0.06835592btc, 26.44739516vtc
2014-04-03 11:02:20 bter:    0.11959352btc, 4.45710196vtc
2014-04-03 11:02:22 bter:    0.06835592btc, 26.44739516vtc
2014-04-03 11:03:40 bter:    0.11959352btc, 4.45710196vtc
2014-04-03 11:03:42 bter:    0.06835592btc, 26.44739516vtc
and so on.

Nothing suspicious in other parts of json (result is always true, etc).

I contacted support with detailed logs and json files, but their response is not encouraging as yet ("we'll look into it in later").

Has anyone run into the issue? Can anyone reproduce? Any ideas of a workaround?


Title: Re: Bter API problem
Post by: libertynow on April 16, 2014, 08:27:59 PM
I observe some very strange behaviour: my balance (as reported by getFunds call) jumps from one (correct) value to another (incorrect) value approximately once per minute, although no trading activity is in place:

2014-04-03 11:02:04 bter:    0.06835592btc, 26.44739516vtc
2014-04-03 11:02:20 bter:    0.11959352btc, 4.45710196vtc
2014-04-03 11:02:22 bter:    0.06835592btc, 26.44739516vtc
2014-04-03 11:03:40 bter:    0.11959352btc, 4.45710196vtc
2014-04-03 11:03:42 bter:    0.06835592btc, 26.44739516vtc
and so on.

Nothing suspicious in other parts of json (result is always true, etc).

I contacted support with detailed logs and json files, but their response is not encouraging as yet ("we'll look into it in later").

Has anyone run into the issue? Can anyone reproduce? Any ideas of a workaround?


I have this same problem, now, too.  It's been working fine for a week, but now I get what seems to be a cached funds list from like yesterday or something.  It happens about every 2 or 3 minutes with me.  Did you figure out the problem?  Any help would be appreciated.


Title: Re: Bter API problem
Post by: sase on April 18, 2014, 11:02:28 PM
I am having a strange behavior too.

It seems that bter modifies the orders before creating them, if we use the API.


I used the python API provided here (https://github.com/hsharrison/bter-api) to create a "buy" order:
Price: 0.02499999 BTC per LTC

I received the confirmation from the server, with the correct price.

But on the webpage I see my order with this price: 0.02531011

Does Bter take an extra fee if we use the API, or is it buggy ?