Bitcoin Forum
May 09, 2024, 10:11:42 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Poloniex API for PHP  (Read 11171 times)
plateadodev (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 0


View Profile WWW
April 03, 2016, 06:38:44 AM
Last edit: April 03, 2016, 06:54:15 AM by plateadodev
 #1

Hi there, Today I started to work on a PHP class to use Poloniex API in a simple way (only public API by now).
https://github.com/platedodev/Poloniex-API-for-PHP
It'll be finish in a week or two, hope you find it useful.
If you've any idea or suggestion to share with me or would like me to develop something, let me know Smiley.
Have a nice day.
1715292702
Hero Member
*
Offline Offline

Posts: 1715292702

View Profile Personal Message (Offline)

Ignore
1715292702
Reply with quote  #2

1715292702
Report to moderator
1715292702
Hero Member
*
Offline Offline

Posts: 1715292702

View Profile Personal Message (Offline)

Ignore
1715292702
Reply with quote  #2

1715292702
Report to moderator
1715292702
Hero Member
*
Offline Offline

Posts: 1715292702

View Profile Personal Message (Offline)

Ignore
1715292702
Reply with quote  #2

1715292702
Report to moderator
It is a common myth that Bitcoin is ruled by a majority of miners. This is not true. Bitcoin miners "vote" on the ordering of transactions, but that's all they do. They can't vote to change the network rules.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715292702
Hero Member
*
Offline Offline

Posts: 1715292702

View Profile Personal Message (Offline)

Ignore
1715292702
Reply with quote  #2

1715292702
Report to moderator
1715292702
Hero Member
*
Offline Offline

Posts: 1715292702

View Profile Personal Message (Offline)

Ignore
1715292702
Reply with quote  #2

1715292702
Report to moderator
1715292702
Hero Member
*
Offline Offline

Posts: 1715292702

View Profile Personal Message (Offline)

Ignore
1715292702
Reply with quote  #2

1715292702
Report to moderator
AdamCox9
Full Member
***
Offline Offline

Activity: 145
Merit: 112

To the moon!


View Profile WWW
April 05, 2016, 07:38:37 AM
 #2

Hi there, Today I started to work on a PHP class to use Poloniex API in a simple way (only public API by now).
https://github.com/platedodev/Poloniex-API-for-PHP
It'll be finish in a week or two, hope you find it useful.
If you've any idea or suggestion to share with me or would like me to develop something, let me know Smiley.
Have a nice day.

Check out NickelBot. There is an API and Adapter that cover Poloniex: https://github.com/AdamCox9/nickelbot/tree/master/adapters/poloniex

I'm looking for developers to help build some custom bots: https://github.com/AdamCox9/nickelbot/tree/master/bots

You can see the sample website up and running at http://www.nickelbot.com/

Buy Bitcoin!
tyz
Legendary
*
Offline Offline

Activity: 3360
Merit: 1531



View Profile
April 06, 2016, 11:28:59 AM
 #3

Thanks for sharing! It is definetely very useful for programmers. From time to time, I develop scripts using a various exchanges. I add you Github resource to my favourites. When I gonna use it then I will give a feedback about the quality and possible improvements.

Hi there, Today I started to work on a PHP class to use Poloniex API in a simple way (only public API by now).
https://github.com/platedodev/Poloniex-API-for-PHP
It'll be finish in a week or two, hope you find it useful.
If you've any idea or suggestion to share with me or would like me to develop something, let me know Smiley.
Have a nice day.
Emerge
Legendary
*
Offline Offline

Activity: 854
Merit: 1000



View Profile
April 06, 2016, 11:33:07 AM
 #4

Great work! I always support developers who work on using APIs Smiley Hope you continue development
petricag
Full Member
***
Offline Offline

Activity: 210
Merit: 100


View Profile
February 06, 2017, 11:35:06 PM
 #5

I don't seem to find a simple example about how to use all these classes you guys are publishing.
A lot of code, and private and public, secret key ? wtf ? ... a lot of mambo jambo for someone that don't know oop and just want to use a simple function, to retrieve some info like

include(poloniexApi.php)
$ethSellPrice = get_eth_sell_price() -> should return best sell price at the moment the function is called
$ethBuyPrice = get_eth_buy_price() -> should return best buy price at the moment the function is called

Can anyone point me in the right direction, without having to learn all the OOP concept? I really needed for my simple page to track the profit of my small portfolio ... no bot trading, or anything fancy .. just refresh a page, these simple functions get the values, and are entered into calculation.  
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1179



View Profile WWW
February 07, 2017, 05:21:17 AM
 #6

I don't seem to find a simple example about how to use all these classes you guys are publishing.
A lot of code, and private and public, secret key ? wtf ? ... a lot of mambo jambo for someone that don't know oop and just want to use a simple function, to retrieve some info like

include(poloniexApi.php)
$ethSellPrice = get_eth_sell_price() -> should return best sell price at the moment the function is called
$ethBuyPrice = get_eth_buy_price() -> should return best buy price at the moment the function is called

Can anyone point me in the right direction, without having to learn all the OOP concept? I really needed for my simple page to track the profit of my small portfolio ... no bot trading, or anything fancy .. just refresh a page, these simple functions get the values, and are entered into calculation.  

OP is creating a library to be used with Polo. Libraries are always created with classes and functions.
To use his library you would first save the Poloniex.php file to your server and then require it.

Code:
require("Poloniex.php");

Then instantiate the class with your Poloniex API key and API secret.
You can have your API key and secret stored in a variable or just insert it in.

Code:
$polo = new Poloniex($key, $secret);
or
Code:
$polo = new Poloniex("L5knblahblah", "5Xnrblahblah");

Then you can start using the different functions.
One is returnTicker()

You would use it by hitting the class ($polo) then the function

Code:
$polo = new Poloniex($key, $secret);
$ticker = $polo->returnTicker();

The in-code notation tells us this will come back as an array. So we can output it with var_dump or print_r

Code:
$polo = new Poloniex($key, $secret);
$ticker = $polo->returnTicker();
print_r($ticker);

Let's look at another one that includes a parameter, returnOrderBook()

We can either enter in a currency pair or leave it blank to retrieve all.

Code:
$polo = new Poloniex($key, $secret);
$orderbook = $polo->returnOrderBook("ETHBTC");
print_r($orderbook);
or blank for all orderbooks
Code:
$polo = new Poloniex($key, $secret);
$orderbook = $polo->returnOrderBook();
print_r($orderbook);

Hope that helps. Keep going through the different public functions to see what's available.

petricag
Full Member
***
Offline Offline

Activity: 210
Merit: 100


View Profile
February 07, 2017, 08:57:12 PM
 #7

Thanks man
I will give it a try and get back
petricag
Full Member
***
Offline Offline

Activity: 210
Merit: 100


View Profile
February 07, 2017, 09:17:15 PM
 #8

Yeap ... this is the key Smiley
Thanks again

Code:

$polo = new Poloniex("L5knblahblah", "5Xnrblahblah");
$ticker = $polo->returnTicker();
print_r($ticker['BTC_ETH']['lowestAsk']);

bitKaBoom
Full Member
***
Offline Offline

Activity: 166
Merit: 100



View Profile
February 09, 2017, 04:47:53 AM
 #9

Thanks,
I will use it for my new profitable bot.
Good job friend!
DreamSpace
Hero Member
*****
Offline Offline

Activity: 556
Merit: 500



View Profile
February 11, 2017, 01:17:40 PM
 #10

Great work, i will try it out.
Just thought about it and here it is Smiley.
nemgun
Hero Member
*****
Offline Offline

Activity: 882
Merit: 533



View Profile WWW
February 12, 2017, 02:15:18 PM
 #11

Nice work, i am also working on some libraries but only to querry prices and other informations from public API exchanges.
Coinables is awesome, i learned a lot from his videos.
I am also happy that for the first time some one used this
Code:
$uri = file_get_contents('https://poloniex.com/public?command='.$command);
Usually people calls Curl but it is like 4 or 5 lines of code, while file_get_contents is just one line, which is less time consuming especially if you have several calls to do, plus, a short code is a quick code.
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1179



View Profile WWW
February 12, 2017, 10:35:09 PM
 #12

Nice work, i am also working on some libraries but only to querry prices and other informations from public API exchanges.
Coinables is awesome, i learned a lot from his videos.
I am also happy that for the first time some one used this
Code:
$uri = file_get_contents('https://poloniex.com/public?command='.$command);
Usually people calls Curl but it is like 4 or 5 lines of code, while file_get_contents is just one line, which is less time consuming especially if you have several calls to do, plus, a short code is a quick code.

Thanks nemgun.
Yea file_get_contents() is the quick and dirty way. cURL should be used for most production applications as it is more secure and is able to verify SSL certs.

nemgun
Hero Member
*****
Offline Offline

Activity: 882
Merit: 533



View Profile WWW
February 12, 2017, 11:22:51 PM
 #13

Nice work, i am also working on some libraries but only to querry prices and other informations from public API exchanges.
Coinables is awesome, i learned a lot from his videos.
I am also happy that for the first time some one used this
Code:
$uri = file_get_contents('https://poloniex.com/public?command='.$command);
Usually people calls Curl but it is like 4 or 5 lines of code, while file_get_contents is just one line, which is less time consuming especially if you have several calls to do, plus, a short code is a quick code.

Thanks nemgun.
Yea file_get_contents() is the quick and dirty way. cURL should be used for most production applications as it is more secure and is able to verify SSL certs.

Yes, but i think that all of these are going to be deprecated soon, nodejs and other langueages will soon kick PHP off the scene.
If someone wants to have an idea about security, just try to do it usin ajax requests in javascript console. you won't be able to do it unless you are on an empty tab because of the security locks, this means that file_get_contents isn't compliant, but it is still handy for tutorials, if you want to use for production, just amend the library.
msti
Member
**
Offline Offline

Activity: 90
Merit: 10


View Profile
February 13, 2017, 08:21:43 PM
 #14

This is a poloniex lending bot built with python. https://github.com/Mikadily/poloniexlendingbot
amGigolo
Full Member
***
Offline Offline

Activity: 164
Merit: 100


View Profile
March 04, 2017, 11:29:47 PM
 #15

I was looking into this and the api but i cant see to find  does this  send back any alerts on confirmations  of a deposit etc?
numismatist
Legendary
*
Offline Offline

Activity: 1245
Merit: 1004



View Profile
March 06, 2017, 02:30:35 AM
 #16

Yeap ... this is the key Smiley
Thanks again

Code:

$polo = new Poloniex("L5knblahblah", "5Xnrblahblah");
$ticker = $polo->returnTicker();
print_r($ticker['BTC_ETH']['lowestAsk']);


Looks like this ticker is real time data. What would interest me is the product of some historical data on a graph plot, like XMRBTC * BTC_USDT to observe the Monero value moving over time.
This is tradeable when you can differentiate cheap vs. expensive and if currently following along Bitcoin or against it.

nemgun
Hero Member
*****
Offline Offline

Activity: 882
Merit: 533



View Profile WWW
March 06, 2017, 02:01:16 PM
 #17

Yeap ... this is the key Smiley
Thanks again

Code:

$polo = new Poloniex("L5knblahblah", "5Xnrblahblah");
$ticker = $polo->returnTicker();
print_r($ticker['BTC_ETH']['lowestAsk']);


Looks like this ticker is real time data. What would interest me is the product of some historical data on a graph plot, like XMRBTC * BTC_USDT to observe the Monero value moving over time.
This is tradeable when you can differentiate cheap vs. expensive and if currently following along Bitcoin or against it.

Interesting indeed, i would like to see the result when done.

https://poloniex.com/public?command=returnChartData&currencyPair=BTC_XMR
https://poloniex.com/public?command=returnChartData&currencyPair=USDT_BTC

Do this :

Code:
$polo = new Poloniex("L5knblahblah", "5Xnrblahblah");
$XMR = "BTC_XMR",$USDT="USDT_BTC";
$XMRh = $polo->returnCharData($XMR, 1405699200, 9999999999, 14400); // the other values are taken from poloniex api documentation
$USDTh= $polo->returnChartData($USDT, 1405699200, 9999999999, 14400);
$Info = [$XMRh, $USDTh];
echo(json_encode($Info));

You can write this in a info.php page, and then call it with ajax in annother page to read the data from, you could then process them in a highcharts or charts.js object to display the chart.
freemanjackal
Sr. Member
****
Offline Offline

Activity: 378
Merit: 250


View Profile
March 18, 2017, 08:17:21 PM
 #18

Hi there, Today I started to work on a PHP class to use Poloniex API in a simple way (only public API by now).
https://github.com/platedodev/Poloniex-API-for-PHP
It'll be finish in a week or two, hope you find it useful.
If you've any idea or suggestion to share with me or would like me to develop something, let me know Smiley.
Have a nice day.

Check out NickelBot. There is an API and Adapter that cover Poloniex: https://github.com/AdamCox9/nickelbot/tree/master/adapters/poloniex

I'm looking for developers to help build some custom bots: https://github.com/AdamCox9/nickelbot/tree/master/bots

You can see the sample website up and running at http://www.nickelbot.com/
what you posted isnt working, and it is just showing information that should not be public cause can be used by any atacker to harm or shut down your site
Rotsor
Full Member
***
Offline Offline

Activity: 309
Merit: 102


Presale is live!


View Profile
March 19, 2017, 09:58:10 AM
 #19

what you posted isnt working, and it is just showing information that should not be public cause can be used by any atacker to harm or shut down your site
It's a spam. See how old is the OG post.

nemgun
Hero Member
*****
Offline Offline

Activity: 882
Merit: 533



View Profile WWW
March 19, 2017, 10:01:10 AM
 #20

what you posted isnt working, and it is just showing information that should not be public cause can be used by any atacker to harm or shut down your site
It's a spam. See how old is the OG post.

He is talking about nickelbot i think, because the library itself will work unless poloniex changes their methods, even if so, one can just change it and it will work again, i made a library for poloniex but without Private API support, i had a look at it, and the one provided here is correct, so it will work.

If this one doesn't suits you, you can use the Poloniex-node-api.
Pages: [1] 2 »  All
  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!