Package Exports
- xapi-wrapper
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (xapi-wrapper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
##Overview
Simple async xAPI 3.0 wrapper for Node.js written in Coffeescript.
##Prerequisites
Node version 0.10 or higher (testes on Node v0.10.30)
##Instalation
##Example wrapper usage
##Wrapper Docs (Draft)
###Class: Wrapper(server_url, conn_port, stream_port, username, password, [options])
The main Wrapper class. By using it you initialize the client. Example:
Wrapper = new Wrapper(SERVER_URL, CONN_PORT, STREAM_PORT, USERNAME, PASSWORD)
You can then use the Wrapper methods and properties to interact with xapi.
Options should be an object. Example
Options =
autoReconnect: true
###Wrapper.connect()
Connects to the specified server and conn port
###Wrapper.disconnect()
Disconnects from the server
###Wrapper.on(event, callback)
Registeres a callback for an event. For events generated on responses to commands, the callback should take 3 arguments ([error], request, response)
List of events:
open
error
close
login
logout
addOrder
closePosition
deletePending
getAccountIndicators
getAccountInfo
getAllSymbols
...
###Wrapper.login([args], [customTag])
Logs user to the xapi server
###Wrapper.logout([customTag])
Logs out of the server
###Wrapper.addOrder(args, [customTag])
Sends an order with the specified arguments.
###Wrapper.connectStream()
Connects to the streaming port
###Wrapper.disconnectStream()
Disconnects from the streaming port
###Wrapper.server_url
Returns the instance server url
###Wrapper.conn_port
Returns the insance port for the normal socket connection
###Wrapper.stream_port
Returns the instance port for the stream connection
###Wrapper.username
Returns the instance username. Username is used to login to xapi
###Wrapper.password
Returns the instance password. Password is used to login to xapi
###Wrapper.conn_status
Returns the current status of the connection
###Wrapper.stream_status
Returns the current status of the stream