Exchange
/E
is a object with some exchange methods.
Log
E.Log(Message:
Any
) =>No Return
E.Log("I'm running…");
// Send a message of this exchange to web control
GetType
E.GetType() =>
String
var thisType = E.GetType();
// Get the type of this exchange
GetName
E.GetName() =>
String
var thisName = E.GetName();
// Get the name of this exchange
GetMainStock
E.GetMainStock() =>
String
var thisMainStock = E.GetMainStock();
// Get the main stock type of this exchange
SetMainStock
E.SetMainStock(StockType:
String
) =>String
var newMainStockType = E.SetMainStock("LTC");
// Set the main stock type of this exchange
SetLimit
E.SetLimit(times:
Number
) =>Number
var newLimit = E.SetLimit(6);
// Set the limit calls amount per second of this exchange
SetLimit
E.SetLimit(times:
Number
) =>Number
var newLimit = E.SetLimit(6);
// Set the limit calls amount per second of this exchange
// Work with E.AutoSleep()
AutoSleep
E.AutoSleep() =>
No Return
E.AutoSleep();
// Auto sleep to achieve the limit calls amount per second of this exchange
GetAccount
E.GetAccount() =>
Account
var thisAccount = E.GetAccount();
// Get the account info of this exchange
Buy
E.Buy(StockType:
String
, Price:Number
, Amount:Number
, Message:Any
) =>String
/Boolean
// if Price <= 0, it's a market order, and the Amount will be different
E.Buy("BTC", 600, 0.5, "I paid $300"); // normal order
E.Buy("BTC", 0, 300, "I also paid $300"); // market order
// Return ID of this order if succeed
// Return false if fail
Sell
E.Sell(StockType:
String
, Price:Number
, Amount:Number
, Message:Any
) =>String
/Boolean
// if Price <= 0, it's a market order
E.Sell("BTC", 600, 0.5); // normal order
E.Sell("BTC", 0, 0.5); // market order
// Return ID of this order if succeed
// Return false if fail
GetOrder
E.GetOrder(StockType:
String
, ID:String
) =>Order
/Boolean
var thisOrder = E.GetOrder("BTC", "XXXXXX");
// Return info of this order if succeed
// Return false if fail
GetOrders
E.GetOrders(StockType:
String
) =>Array
var thisOrders = E.GetOrders("BTC");
// Return all the undone orders
GetTrades
E.GetTrades(StockType:
String
) =>Array
var thisTrades = E.GetTrades("BTC");
// Return all the done orders
CancelOrder
E.CancelOrder(Order:
Order
) =>Boolean
var thisOrders = E.GetOrders("BTC");
for (var i = 0; i < thisOrders.length; i++) {
var isCanceled = E.CancelOrder(thisOrders[i]);
// Return the result
}
GetTicker
E.GetTicker(StockType:
String
, Size:Any
) =>Ticker
var thisTicker = E.GetTicker("BTC");
// Get the latest ticker of this exchange
GetRecords
E.GetRecords(StockType:
String
, Period:String
, Size:Any
) =>Array
var thisRecords = E.GetRecords("BTC", "M5");
// Get the latest records of this exchange