public class Layer1ApiUpstreamRelay extends Layer1ApiBasicListenable implements Layer1ApiListener
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.atomic.AtomicBoolean |
closed |
adminListeners, dataListeners, instrumentListeners, mboDataListeners, tradingListeners
Constructor and Description |
---|
Layer1ApiUpstreamRelay() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Stop relaying data.
|
void |
onBalance(BalanceInfo balanceInfo)
Called when account balance information changes
|
void |
onConnectionLost(DisconnectionReason reason,
java.lang.String message)
Connection to server lost
|
void |
onConnectionRestored()
Connection to server restored
|
void |
onDepth(java.lang.String alias,
boolean isBid,
int price,
int size)
Depth data update.
|
void |
onInstrumentAdded(java.lang.String alias,
InstrumentInfo instrumentInfo)
Indicates successful subscription to the instrument
|
void |
onInstrumentAlreadySubscribed(java.lang.String symbol,
java.lang.String exchange,
java.lang.String type)
Indicates that attempt to subscribe failed because subscription is
already active
|
void |
onInstrumentNotFound(java.lang.String symbol,
java.lang.String exchange,
java.lang.String type)
Indicates that attempt to subscribe failed because instrument does not
exist
|
void |
onInstrumentRemoved(java.lang.String alias)
Unsubscribed from instrument (user-initiated or provider initiated).
Please note that if you use this in strategy that implements OnlineCalculatable ,
you should not delete any data about instrument that is expected in OnlineCalculatable.calculateValuesInRange(String, String, long, long, int, velox.api.layer1.layers.strategies.interfaces.CalculatedResultListener)
or OnlineCalculatable.createOnlineValueCalculator(String, String, long, java.util.function.Consumer, velox.api.layer1.layers.strategies.interfaces.InvalidateInterface) ,
or should handle absence of that data (in case you delete it) gracefully. |
void |
onLoginFailed(LoginFailedReason reason,
java.lang.String message)
Failed to login with specified credentials
|
void |
onLoginSuccessful()
Successful login.
|
void |
onMarketMode(java.lang.String alias,
MarketMode marketMode)
Market mode update.
|
void |
onMboCancel(java.lang.String alias,
java.lang.String orderId) |
void |
onMboReplace(java.lang.String alias,
java.lang.String orderId,
int price,
int size) |
void |
onMboSend(java.lang.String alias,
java.lang.String orderId,
boolean isBid,
int price,
int size) |
void |
onOrderExecuted(ExecutionInfo executionInfo)
Called when one of our orders gets executed
|
void |
onOrderUpdated(OrderInfoUpdate orderInfoUpdate)
Called when order is updated (order creation is also considered an
update).
|
void |
onStatus(StatusInfo statusInfo)
Called when instrument status information changes (PnL, number of open
orders, position, etc).
|
void |
onSystemTextMessage(java.lang.String message,
SystemTextMessageType messageType)
Some message from the system.
|
void |
onTrade(java.lang.String alias,
double price,
int size,
TradeInfo tradeInfo)
Trade
|
void |
onUserMessage(java.lang.Object data)
Allows incorporating arbitrary functionality into protocol
|
addListener, addListener, addListener, addListener, addListener, getAdminListenerBroadcaster, getDataListenerBroadcaster, getInstrumentListenerBroadcaster, getTradingListenerBroadcaster, getUniqueListenersCount, onNoSubscribers, removeListener, removeListener, removeListener, removeListener, removeListener
public void onInstrumentAdded(java.lang.String alias, InstrumentInfo instrumentInfo)
Layer1ApiInstrumentListener
onInstrumentAdded
in interface Layer1ApiInstrumentListener
alias
- instrument aliasinstrumentInfo
- instrument specificationspublic void onInstrumentRemoved(java.lang.String alias)
Layer1ApiInstrumentListener
OnlineCalculatable
,
you should not delete any data about instrument that is expected in OnlineCalculatable.calculateValuesInRange(String, String, long, long, int, velox.api.layer1.layers.strategies.interfaces.CalculatedResultListener)
or OnlineCalculatable.createOnlineValueCalculator(String, String, long, java.util.function.Consumer, velox.api.layer1.layers.strategies.interfaces.InvalidateInterface)
,
or should handle absence of that data (in case you delete it) gracefully. The reason is that you can get Layer1ApiInstrumentListener.onInstrumentRemoved(String)
in the middle of OnlineCalculatable
requestonInstrumentRemoved
in interface Layer1ApiInstrumentListener
public void onInstrumentNotFound(java.lang.String symbol, java.lang.String exchange, java.lang.String type)
Layer1ApiInstrumentListener
onInstrumentNotFound
in interface Layer1ApiInstrumentListener
type
- see InstrumentCoreInfo.type
public void onInstrumentAlreadySubscribed(java.lang.String symbol, java.lang.String exchange, java.lang.String type)
Layer1ApiInstrumentListener
onInstrumentAlreadySubscribed
in interface Layer1ApiInstrumentListener
type
- see InstrumentCoreInfo.type
public void onTrade(java.lang.String alias, double price, int size, TradeInfo tradeInfo)
Layer1ApiDataListener
onTrade
in interface Layer1ApiDataListener
alias
- instrument aliasprice
- price in the same units as in depth update (e.g. if pips=25
then price=1000 means 25000)size
- trade sizetradeInfo
- additional information about the tradepublic void onDepth(java.lang.String alias, boolean isBid, int price, int size)
Layer1ApiDataListener
onDepth
in interface Layer1ApiDataListener
alias
- instrument aliasisBid
- true if it is for bids, false for asksprice
- price where size changedsize
- new sizepublic void onMboSend(java.lang.String alias, java.lang.String orderId, boolean isBid, int price, int size)
onMboSend
in interface Layer1ApiMboDataListener
public void onMboReplace(java.lang.String alias, java.lang.String orderId, int price, int size)
onMboReplace
in interface Layer1ApiMboDataListener
public void onMboCancel(java.lang.String alias, java.lang.String orderId)
onMboCancel
in interface Layer1ApiMboDataListener
public void onMarketMode(java.lang.String alias, MarketMode marketMode)
Layer1ApiDataListener
onMarketMode
in interface Layer1ApiDataListener
public void onOrderUpdated(OrderInfoUpdate orderInfoUpdate)
Layer1ApiTradingListener
onOrderUpdated
in interface Layer1ApiTradingListener
orderInfoUpdate
- information about updatepublic void onOrderExecuted(ExecutionInfo executionInfo)
Layer1ApiTradingListener
onOrderExecuted
in interface Layer1ApiTradingListener
executionInfo
- information about executionpublic void onStatus(StatusInfo statusInfo)
Layer1ApiTradingListener
onStatus
in interface Layer1ApiTradingListener
statusInfo
- status informationpublic void onBalance(BalanceInfo balanceInfo)
Layer1ApiTradingListener
onBalance
in interface Layer1ApiTradingListener
balanceInfo
- account balance informationpublic void onLoginFailed(LoginFailedReason reason, java.lang.String message)
Layer1ApiAdminListener
onLoginFailed
in interface Layer1ApiAdminListener
reason
- reason codemessage
- test message associated with login fail (may be null)public void onLoginSuccessful()
Layer1ApiAdminListener
onLoginSuccessful
in interface Layer1ApiAdminListener
public void onConnectionLost(DisconnectionReason reason, java.lang.String message)
Layer1ApiAdminListener
onConnectionLost
in interface Layer1ApiAdminListener
reason
- reason codemessage
- test message associated with login disconnection (may be null)public void onConnectionRestored()
Layer1ApiAdminListener
onConnectionRestored
in interface Layer1ApiAdminListener
public void onSystemTextMessage(java.lang.String message, SystemTextMessageType messageType)
Layer1ApiAdminListener
onSystemTextMessage
in interface Layer1ApiAdminListener
message
- message itselfmessageType
- message typepublic void onUserMessage(java.lang.Object data)
Layer1ApiAdminListener
onUserMessage
in interface Layer1ApiAdminListener
data
- Message contentpublic void close()