Bitcoin Forum
May 03, 2024, 08:34:43 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: learning mtgox API  (Read 1501 times)
solomon (OP)
Full Member
***
Offline Offline

Activity: 120
Merit: 100



View Profile
March 03, 2013, 01:35:02 AM
 #1

Hi i am trying to learn how to use the mtgox api but am struggling with some things.

I have managed to make some basic api calls, but am unsure how to pass parameters when it is necessary.


for example to submit an order the wiki says:

###
Submit an order

https://mtgox.com/api/1/BTCUSD/private/order/add

parameters:

    type (bid|ask) (easier to remember: bid == buy, ask == sell)
    amount_int <amount as int>
    price_int <price as int> (can be omitted to place market order)

submits an order and returns the OID and info about success or error
###


I tried:

https://mtgox.com/api/1/BTCUSD/private/order/add?type=ask?amount_int=100000000?price_int=2500000

But im just getting error:

"Invalid parameter "type" (should be ask or bid)"


(Also in INT is 100000000 = 1BTC?)

bitcoin price ticker | bits.so
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714725283
Hero Member
*
Offline Offline

Posts: 1714725283

View Profile Personal Message (Offline)

Ignore
1714725283
Reply with quote  #2

1714725283
Report to moderator
1714725283
Hero Member
*
Offline Offline

Posts: 1714725283

View Profile Personal Message (Offline)

Ignore
1714725283
Reply with quote  #2

1714725283
Report to moderator
bitspill
Legendary
*
Offline Offline

Activity: 2058
Merit: 1015



View Profile
March 03, 2013, 06:13:35 AM
 #2

I don't personally have much experience with the mtgox api however I do see that your url's are wrong. Rather than ?'s between parameters you must use an &

As such:

https://mtgox.com/api/1/BTCUSD/private/order/add?type=ask&amount_int=100000000&price_int=2500000

{ BitSpill }
solomon (OP)
Full Member
***
Offline Offline

Activity: 120
Merit: 100



View Profile
March 03, 2013, 11:24:10 AM
 #3

OK thanks. I figured i'd have some of the syntax wrong.

It's frustrating that there's so little information available, and the wiki gives details but no examples of how to pass multiple variables. I can learn but i need examples!  Grin

I'm still getting the error, maybe i will post to dev forum, i thought it was too basic tbh.

bitcoin price ticker | bits.so
boristheblade
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
March 03, 2013, 11:34:39 AM
 #4

that's, funny. I'm having the exact same problem right now. let me know if you get anywhere with it.
kokjo
Legendary
*
Offline Offline

Activity: 1050
Merit: 1000

You are WRONG!


View Profile
March 03, 2013, 11:38:29 AM
 #5

https://en.bitcoin.it/wiki/MtGox/API/HTTP

"The whole problem with the world is that fools and fanatics are always so certain of themselves and wiser people so full of doubts." -Bertrand Russell
solomon (OP)
Full Member
***
Offline Offline

Activity: 120
Merit: 100



View Profile
March 03, 2013, 12:31:38 PM
 #6

OK i figured out how to do it, someone should update the wiki


that's, funny. I'm having the exact same problem right now. let me know if you get anywhere with it.


I'm using php so a market order for .v1 would be the same as the example shown here (https://en.bitcoin.it/wiki/MtGox/API/HTTP) except instead of:

var_dump(mtgox_query('0/buyBTC.php', array('amount' => 1, 'price' => 15)));

it would be something like

var_dump(mtgox_query('1/BTCUSD/private/order/add', array('type' => 'bid', 'amount_int' => 100000000, "price_int" => 1500000) ) );

bitcoin price ticker | bits.so
boristheblade
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
March 03, 2013, 07:43:34 PM
 #7

I'm using java. What does the actual final url look like?
bitmango
Newbie
*
Offline Offline

Activity: 29
Merit: 0


View Profile WWW
March 27, 2013, 11:39:05 AM
 #8

Hi,

I'm trying to extract the amount of cash I have in my wallet and put it into a variable.

I'm using :
Code:
var_export(mtgox_query('1/generic/private/info'), true);

Which captures information, but I can't for the life of me work out how to separate the resulting arrays into variables. Can anyone help?

i.e. I want:
Code:
array (
  'result' => 'success',
  'return' =>
  array (
'USD' =>
     array (
        'Balance' =>
        array (
          'value' => '0.00',
        ),

to become:
Code:
$wallet_cash_balance = 'Balance'

Can anyone educate me???

The main problem that i'm having is that there are multiple arrays embedded, and so I can't find any useful php code examples online.
kokjo
Legendary
*
Offline Offline

Activity: 1050
Merit: 1000

You are WRONG!


View Profile
March 27, 2013, 04:49:29 PM
 #9

http://lmgtfy.com/?q=nested+array+php

"The whole problem with the world is that fools and fanatics are always so certain of themselves and wiser people so full of doubts." -Bertrand Russell
kiolo
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
March 28, 2013, 07:13:35 AM
 #10

this is best for me: http://www.mediafire.com/?rtn3yepl5lxtnvx
bombartier357
Full Member
***
Offline Offline

Activity: 148
Merit: 100


View Profile WWW
March 28, 2013, 09:38:15 PM
 #11

Shoot me a PM and I will send you some of my code that I use.  I am at work right now and therefore do not have access to my code.

I currently have 14 bots running that trade bitcoin based on different parameters.  So I do have quite a bit of experience with this.

I would be happy to walk you through it.
happygeorge
Full Member
***
Offline Offline

Activity: 146
Merit: 100


In da Jungle!


View Profile
March 30, 2013, 05:21:27 PM
 #12

Is there a really simple "excel" - style api handling program, or is it all raw C or Python or what is everybody doing to do this?

Where do I get started with an easy API programing BOT creation tool?
dkstar
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
May 07, 2013, 02:08:00 AM
 #13

I am also having a problem trying to pass my parameters as such

https://mtgox.com/api/1/BTCUSD/private/order/add?type=ask&amount_int=100000000&price_int=2500000

I am using python, does anyone know what the solution here is?

Thanks
maverick1337
Newbie
*
Offline Offline

Activity: 40
Merit: 0


View Profile
May 07, 2013, 03:04:28 AM
 #14

I have a question, is there anyway to have a bot send out a notification when the EMA lines cross? I'm sure you guys are initiating buys and sells via EMA (maybe not) but if you are, could you just have it send a notification without trading at all? I know you spend a lot of time and effort in your code but if someone has this functionality, I would greatly appreciate it. You can even delete all the rest of the code, I would just want to be notified when the EMA lines cross. Thanks.
anyroll
Newbie
*
Offline Offline

Activity: 14
Merit: 0



View Profile
May 07, 2013, 03:56:28 AM
 #15

I have a question, is there anyway to have a bot send out a notification when the EMA lines cross? I'm sure you guys are initiating buys and sells via EMA (maybe not) but if you are, could you just have it send a notification without trading at all? I know you spend a lot of time and effort in your code but if someone has this functionality, I would greatly appreciate it. You can even delete all the rest of the code, I would just want to be notified when the EMA lines cross. Thanks.
+1
kokjo
Legendary
*
Offline Offline

Activity: 1050
Merit: 1000

You are WRONG!


View Profile
May 07, 2013, 05:04:31 PM
 #16

I am also having a problem trying to pass my parameters as such

https://mtgox.com/api/1/BTCUSD/private/order/add?type=ask&amount_int=100000000&price_int=2500000

I am using python, does anyone know what the solution here is?

Thanks
yup! RTFM!

"The whole problem with the world is that fools and fanatics are always so certain of themselves and wiser people so full of doubts." -Bertrand Russell
dkstar
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
May 09, 2013, 11:35:44 AM
 #17

Geeze, whats the point of having a "newbie" forum...  There is a lot of documentation to go through and it takes those of us with smaller programming vocabularies a lot to get through it all. I solved my problem, so for anyone else having the same issue I read the "FM"...

here is some good background on the request module and has a specific section on passing parameter in a url with a keyword argument.  You then need to urlencode your parameters.
 
http://docs.python-requests.org/en/latest/index.html

WarlockTheGrait
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
May 30, 2013, 09:58:35 PM
 #18

hi everyone. sorry for poor english. i'm trying to move to 1st API vers. our clien(Java). when i'm trying to submint an order with params
type - bid
amount_int - 10000000
price_int - 2500000000
server returns "" string
how i can see magicnumber thats server uses to divide by amount and price is 10^6 (i tryed 10^4 too - in result was "too low amount")
can u help?
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!