public class Layer1ApiInjectorRelay extends Layer1ApiRelay
Layer1ApiTimeSource.Layer1TimeSourceShortcutAllowed| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Object |
upstreamInjectorLock |
providerclosedadminListeners, dataListeners, instrumentListeners, mboDataListeners, tradingListeners| Constructor and Description |
|---|
Layer1ApiInjectorRelay(Layer1ApiProvider provider) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Stop relaying data.
|
protected void |
inject(java.lang.Runnable r)
Inject runnable into messages stream provider -> gui.
|
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
|
protected void |
safeInject(java.lang.Runnable r)
Deprecated.
|
formatPrice, getCurrentTime, getSource, getSupportedFeatures, getTimeSource, login, sendOrder, sendUserMessage, setProvider, subscribe, unsubscribe, updateOrderaddListener, addListener, addListener, addListener, addListener, getAdminListenerBroadcaster, getDataListenerBroadcaster, getInstrumentListenerBroadcaster, getTradingListenerBroadcaster, getUniqueListenersCount, onNoSubscribers, removeListener, removeListener, removeListener, removeListener, removeListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsubscribeaddListener, removeListeneraddListener, removeListeneraddListener, removeListeneraddListener, removeListeneraddListener, removeListenergetTimeSourcepublic Layer1ApiInjectorRelay(Layer1ApiProvider provider)
protected void inject(java.lang.Runnable r)
@Deprecated protected void safeInject(java.lang.Runnable r)
inject(Runnable) instead.public void close()
Layer1ApiUpstreamRelayclose in interface java.lang.AutoCloseableclose in interface Layer1ApiAdminProviderclose in class Layer1ApiRelaypublic void onInstrumentAdded(java.lang.String alias,
InstrumentInfo instrumentInfo)
Layer1ApiInstrumentListeneronInstrumentAdded in interface Layer1ApiInstrumentListeneronInstrumentAdded in class Layer1ApiUpstreamRelayalias - instrument aliasinstrumentInfo - instrument specificationspublic void onInstrumentRemoved(java.lang.String alias)
Layer1ApiInstrumentListenerOnlineCalculatable,
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 Layer1ApiInstrumentListeneronInstrumentRemoved in class Layer1ApiUpstreamRelaypublic void onInstrumentNotFound(java.lang.String symbol,
java.lang.String exchange,
java.lang.String type)
Layer1ApiInstrumentListeneronInstrumentNotFound in interface Layer1ApiInstrumentListeneronInstrumentNotFound in class Layer1ApiUpstreamRelaytype - see InstrumentCoreInfo.typepublic void onInstrumentAlreadySubscribed(java.lang.String symbol,
java.lang.String exchange,
java.lang.String type)
Layer1ApiInstrumentListeneronInstrumentAlreadySubscribed in interface Layer1ApiInstrumentListeneronInstrumentAlreadySubscribed in class Layer1ApiUpstreamRelaytype - see InstrumentCoreInfo.typepublic void onTrade(java.lang.String alias,
double price,
int size,
TradeInfo tradeInfo)
Layer1ApiDataListeneronTrade in interface Layer1ApiDataListeneronTrade in class Layer1ApiUpstreamRelayalias - 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)
Layer1ApiDataListeneronDepth in interface Layer1ApiDataListeneronDepth in class Layer1ApiUpstreamRelayalias - 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 Layer1ApiMboDataListeneronMboSend in class Layer1ApiUpstreamRelaypublic void onMboReplace(java.lang.String alias,
java.lang.String orderId,
int price,
int size)
onMboReplace in interface Layer1ApiMboDataListeneronMboReplace in class Layer1ApiUpstreamRelaypublic void onMboCancel(java.lang.String alias,
java.lang.String orderId)
onMboCancel in interface Layer1ApiMboDataListeneronMboCancel in class Layer1ApiUpstreamRelaypublic void onMarketMode(java.lang.String alias,
MarketMode marketMode)
Layer1ApiDataListeneronMarketMode in interface Layer1ApiDataListeneronMarketMode in class Layer1ApiUpstreamRelaypublic void onOrderUpdated(OrderInfoUpdate orderInfoUpdate)
Layer1ApiTradingListeneronOrderUpdated in interface Layer1ApiTradingListeneronOrderUpdated in class Layer1ApiUpstreamRelayorderInfoUpdate - information about updatepublic void onOrderExecuted(ExecutionInfo executionInfo)
Layer1ApiTradingListeneronOrderExecuted in interface Layer1ApiTradingListeneronOrderExecuted in class Layer1ApiUpstreamRelayexecutionInfo - information about executionpublic void onStatus(StatusInfo statusInfo)
Layer1ApiTradingListeneronStatus in interface Layer1ApiTradingListeneronStatus in class Layer1ApiUpstreamRelaystatusInfo - status informationpublic void onBalance(BalanceInfo balanceInfo)
Layer1ApiTradingListeneronBalance in interface Layer1ApiTradingListeneronBalance in class Layer1ApiUpstreamRelaybalanceInfo - account balance informationpublic void onLoginFailed(LoginFailedReason reason, java.lang.String message)
Layer1ApiAdminListeneronLoginFailed in interface Layer1ApiAdminListeneronLoginFailed in class Layer1ApiUpstreamRelayreason - reason codemessage - test message associated with login fail (may be null)public void onLoginSuccessful()
Layer1ApiAdminListeneronLoginSuccessful in interface Layer1ApiAdminListeneronLoginSuccessful in class Layer1ApiUpstreamRelaypublic void onConnectionLost(DisconnectionReason reason, java.lang.String message)
Layer1ApiAdminListeneronConnectionLost in interface Layer1ApiAdminListeneronConnectionLost in class Layer1ApiUpstreamRelayreason - reason codemessage - test message associated with login disconnection (may be null)public void onConnectionRestored()
Layer1ApiAdminListeneronConnectionRestored in interface Layer1ApiAdminListeneronConnectionRestored in class Layer1ApiUpstreamRelaypublic void onSystemTextMessage(java.lang.String message,
SystemTextMessageType messageType)
Layer1ApiAdminListeneronSystemTextMessage in interface Layer1ApiAdminListeneronSystemTextMessage in class Layer1ApiUpstreamRelaymessage - message itselfmessageType - message typepublic void onUserMessage(java.lang.Object data)
Layer1ApiAdminListeneronUserMessage in interface Layer1ApiAdminListeneronUserMessage in class Layer1ApiUpstreamRelaydata - Message content