Skip to content

coff/oanda-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oanda-wrapper

Oanda API Wrapper for PHP

Not fully implemented yet! Wanna help? Let me know!

Remarks

I take absolutely no responsibility for consequences of using this software. Some example scripts and tests may open trade positions on your account causing real financial losses! Run test scripts with your DEMO ACCOUNT ONLY! You're using this software on your own risk!

Examples

Usage example:

/* bootstrapping */
$oanda = new \Coff\OandaWrapper\OandaApiClient();
$oanda
    ->setStage(\Coff\OandaWrapper\OandaApiClient::STAGE_DEV)
    ->setAuthToken($config['token'])
    ->setAccount($config['account']);

$caller = new \Coff\OandaWrapper\Caller\GuzzleHttpCaller();

$caller
    ->setHttpRequestClass(\GuzzleHttp\Psr7\Request::class)
    ->setHttpClient(new \GuzzleHttp\Client())
    ->setClient($oanda);

/* usage */
$instrumentName = new InstrumentName(Currency::EUR(), Currency::USD());

$endpoint = new PricingEndpoint();
$endpoint->addInstrument($instrumentName);

$response = $caller
    ->call($endpoint)
    ->getResponse();

Implementation state

General

  • API Caller
  • API client
  • Entities
  • Error handling
  • tests

Endpoints

  • account endpoint (partially)
  • instrument endpoint (partially)
  • order endpoint (partially)
  • trade endpoint
  • position endpoint
  • pricing endpoint (50%)
  • transaction endpoint
  • Oanda ForexLabs (not planned)