Giter VIP home page Giter VIP logo

pl-api-streaming's Introduction

pl-api-streaming

A sample Perl application that connects to OANDA's HTTP based events stream.

Dependencies

This application uses the curl library to make HTTP requests. To install the curl library on ubuntu enter:

sudo apt-get install libwww-curl-perl

Setup

Clone this repo to the location of your choice

You may need to change the permissions of this file to run it:

chmod 755 streaming.pl

Update the following values in the connect_to_stream method in streaming.pl

  • environment
  • accounts
  • accessToken (Authorization)
  • showHeartBeats (toggles the displaying of the stream's heartbeats. 0 for don't show heartbeats, 1 for show heartbeats)

Usage

./streaming.pl

Sample Output

{"heartbeat":{"time":"2014-08-21T13:43:14.000000Z"}}
{"transaction":{"id":654877414,"accountId":8703506,"time":"2014-08-21T13:43:24.000000Z","type":"STOP_LOSS_FILLED","tradeId":654877021,"instrument":"EUR_USD","units":1,"side":"sell","price":1.32678,"pl":-0.0002,"interest":0,"accountBalance":99677.3601}}
{"transaction":{"id":654877419,"accountId":8703506,"time":"2014-08-21T13:43:25.000000Z","type":"STOP_LOSS_FILLED","tradeId":654877314,"instrument":"SPX500_USD","units":1,"side":"sell","price":1987.6,"pl":-0.5477,"interest":0,"accountBalance":99676.8124}}
{"heartbeat":{"time":"2014-08-21T13:43:29.000000Z"}}
{"heartbeat":{"time":"2014-08-21T13:43:44.000000Z"}}
{"transaction":{"id":654877474,"accountId":8703506,"time":"2014-08-21T13:43:46.000000Z","type":"TAKE_PROFIT_FILLED","tradeId":654877239,"instrument":"JP225_USD","units":1,"side":"sell","price":15585.6,"pl":-9.7492,"interest":-0.001,"accountBalance":99667.0622}}
{"heartbeat":{"time":"2014-08-21T13:43:59.000000Z"}}
{"heartbeat":{"time":"2014-08-21T13:44:14.000000Z"}}
{"heartbeat":{"time":"2014-08-21T13:44:29.000000Z"}}
{"transaction":{"id":654877597,"accountId":8703506,"time":"2014-08-21T13:44:40.000000Z","type":"STOP_LOSS_FILLED","tradeId":654877443,"instrument":"SGD_HKD","units":1,"side":"buy","price":6.20101,"pl":-0.0003,"interest":0,"accountBalance":99667.0619}}

More Information

http://developer.oanda.com/

pl-api-streaming's People

Contributors

stuartvc avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.