PHP Wrapper for Oanda Rest API

dev-master 2016-06-02 21:37 UTC

This package is not auto-updated.

Last update: 2024-04-27 17:53:11 UTC


README

#oanda.com REST API Wrapper on PHP Build Status

ToDo

  • getAccounts Method
  • getAccount Method
  • getInstrumentsList Method
  • getCurrentProces
  • getInstrumentHistory
  • getOrders
  • getOrder
  • createOrder
  • modifyOrder
  • closeOrder
  • getOpenTrades
  • getTrade
  • modifyTrade
  • closeTrade
  • getOpenPositions
  • getPositionForInstrument
  • closePosition
  • getTransactionHistory
  • getTransaction
  • getFullAccountHistory

Installing

Github

git clone git@github.com:nikopeikrishvili/Oanda.git
cd Oanda

Examples

GetAccounts Method http://developer.oanda.com/rest-live/accounts/#getAccountsForUser

require_once __DIR__.'/vendor/autolod.php';
$acc = new Account();
$accounts = $acc->getAccounts();

###Returns :

Oanda\response\Accounts Object
(
    [accounts:Oanda\response\Accounts:private] => Array
        (
            [9288783] => Oanda\response\Account Object
                (
                    [accountId:Oanda\response\Account:private] => 9288783
                    [accountName:Oanda\response\Account:private] => nikopeikrishvili
                    [accountCurrency:Oanda\response\Account:private] => USD
                    [marginRate:Oanda\response\Account:private] => 0.02
                )

        )

)

GetAccount

$account = $acc->getAccount('9288783');

Returns :

Oanda\response\getAccount\AccountFull Object
(
    [accountId:Oanda\response\getAccount\AccountFull:private] => 9288783
    [accountName:Oanda\response\getAccount\AccountFull:private] => nikopeikrishvili
    [balance:Oanda\response\getAccount\AccountFull:private] => 10000
    [unrealizedPl:Oanda\response\getAccount\AccountFull:private] => 0
    [realizedPl:Oanda\response\getAccount\AccountFull:private] => 0
    [marginUsed:Oanda\response\getAccount\AccountFull:private] => 0
    [marginAvail:Oanda\response\getAccount\AccountFull:private] => 10000
    [openTrades:Oanda\response\getAccount\AccountFull:private] => 0
    [openOrders:Oanda\response\getAccount\AccountFull:private] => 0
    [marginRate:Oanda\response\getAccount\AccountFull:private] => 0.02
    [accountCurrency:Oanda\response\getAccount\AccountFull:private] => USD
)