Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/admin/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ var uiCtrl = ($scope : MainWindowScope,
$log : ng.ILogService,
subscriberFactory : Shared.SubscriberFactory,
fireFactory : Shared.FireFactory) => {

var cancelAllFirer = fireFactory.getFire(Messaging.Topics.CancelAllOrders);
$scope.cancelAllOrders = () => cancelAllFirer.fire(new Models.CancelAllOrdersRequest());

$scope.order = new DisplayOrder(fireFactory, $log);
$scope.pair = null;

Expand Down Expand Up @@ -130,7 +130,7 @@ var requires = ['ui.bootstrap',
Trades.tradeListDirective,
MarketQuoting.marketQuotingDirective,
MarketTrades.marketTradeDirective,
Messages.messagesDirective,
Messages.messagesDirective,
Position.positionDirective,
Tbp.targetBasePositionDirective,
TradeSafety.tradeSafetyDirective,
Expand Down
2 changes: 1 addition & 1 deletion src/admin/orderlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ var OrderListController = ($scope: OrderListScope,
rowHeight: 20,
headerRowHeight: 20,
columnDefs: [
{ width: 120, field: 'time', displayName: 'time', cellFilter: "momentFullDate",
{ width: 120, field: 'time', displayName: 'time', cellFilter: "momentFullDate",
sortingAlgorithm: (a: moment.Moment, b: moment.Moment) => a.diff(b),
sort: { direction: uiGridConstants.DESC, priority: 1} },
{ width: 90, field: 'orderId', displayName: 'id' },
Expand Down
4 changes: 2 additions & 2 deletions src/admin/pair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class FormViewModel<T> {
private _submitConverter: (disp: T) => T = null) {
if (this._submitConverter === null)
this._submitConverter = d => d;

_sub.registerConnectHandler(() => this.connected = true)
.registerDisconnectedHandler(() => this.connected = false)
.registerSubscriber(this.update, us => us.forEach(this.update));

this.connected = _sub.connected;
this.master = angular.copy(defaultParameter);
this.display = angular.copy(defaultParameter);
Expand Down
2 changes: 1 addition & 1 deletion src/admin/shared_directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class EvalAsyncSubscriber<T> implements Messaging.ISubscribe<T> {
};

public disconnect = () => this._wrapped.disconnect();

public get connected() { return this._wrapped.connected; }
}

Expand Down
2 changes: 1 addition & 1 deletion src/admin/trades.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DisplayTrade {
this.price = trade.price;
this.quantity = trade.quantity;
this.value = trade.value;

if (trade.liquidity === 0 || trade.liquidity === 1) {
this.liquidity = Models.Liquidity[trade.liquidity].charAt(0);
}
Expand Down
20 changes: 10 additions & 10 deletions src/common/messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface IPublish<T> {

export class Publisher<T> implements IPublish<T> {
private _snapshot : () => T[] = null;
constructor(private topic : string,
constructor(private topic : string,
private _io : SocketIO.Server,
snapshot : () => T[],
private _log : (...args: any[]) => void) {
Expand All @@ -28,7 +28,7 @@ export class Publisher<T> implements IPublish<T> {
s.on("disconnect", () => {
this._log("socket", s.id, "disconnected for Publisher", topic);
});

s.on(Prefixes.SUBSCRIBE + "-" + topic, () => {
if (this._snapshot !== null) {
var snapshot = this._snapshot();
Expand All @@ -39,7 +39,7 @@ export class Publisher<T> implements IPublish<T> {
};

this._io.on("connection", onConnection);

Object.keys(this._io.sockets.connected).forEach(s => {
onConnection(this._io.sockets.connected[s]);
});
Expand Down Expand Up @@ -79,22 +79,22 @@ export class Subscriber<T> implements ISubscribe<T> {
private _connectHandler : () => void = null;
private _socket : SocketIOClient.Socket;

constructor(private topic : string,
constructor(private topic : string,
io : SocketIOClient.Socket,
private _log : (...args: any[]) => void) {
this._socket = io;

this._log("creating subscriber to", this.topic, "; connected?", this.connected);
if (this.connected)

if (this.connected)
this.onConnect();

this._socket.on("connect", this.onConnect)
.on("disconnect", this.onDisconnect)
.on(Prefixes.MESSAGE + "-" + topic, this.onIncremental)
.on(Prefixes.SNAPSHOT + "-" + topic, this.onSnapshot);
}

public get connected() : boolean {
return this._socket.connected;
}
Expand Down Expand Up @@ -214,7 +214,7 @@ export class Receiver<T> implements IReceive<T> {
_log("error in Receiver", e.stack, e.message);
});
};

io.on("connection", onConnection);
Object.keys(io.sockets.connected).forEach(s => {
onConnection(io.sockets.connected[s]);
Expand Down
Loading