Skip to content

Commit

Permalink
Fixed commented log msgs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ctubio committed Aug 6, 2016
1 parent e234555 commit 54ab3f6
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 48 deletions.
10 changes: 5 additions & 5 deletions src/admin/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class DisplayOrder {

public submit = () => {
var msg = new Models.OrderRequestFromUI(this.side, this.price, this.quantity, this.timeInForce, this.orderType);
// this._log.info("submitting order", msg);
this._log.info("submitting order", msg);
this._fire.fire(msg);
};
}
Expand All @@ -100,7 +100,7 @@ var uiCtrl = ($scope : MainWindowScope,
$scope.pair = null;

var onAdvert = (pa : Models.ProductAdvertisement) => {
// $log.info("advert", pa);
$log.info("advert", pa);
$scope.connected = true;
$scope.env = pa.environment;
$scope.pair_name = Models.Currency[pa.pair.base] + "/" + Models.Currency[pa.pair.quote];
Expand All @@ -109,7 +109,7 @@ var uiCtrl = ($scope : MainWindowScope,
};

var reset = (reason : string) => {
// $log.info("reset", reason);
$log.info("reset", reason);
$scope.connected = false;
$scope.pair_name = null;
$scope.exch_name = null;
Expand All @@ -126,10 +126,10 @@ var uiCtrl = ($scope : MainWindowScope,

$scope.$on('$destroy', () => {
sub.disconnect();
// $log.info("destroy client");
$log.info("destroy client");
});

// $log.info("started client");
$log.info("started client");
};

var requires = ['ui.bootstrap',
Expand Down
4 changes: 2 additions & 2 deletions src/admin/market-quoting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ var MarketQuotingController = ($scope: MarketQuotingScope,

$scope.$on('$destroy', () => {
subscribers.forEach(d => d.disconnect());
// $log.info("destroy market quoting grid");
$log.info("destroy market quoting grid");
});

// $log.info("started market quoting grid");
$log.info("started market quoting grid");
};

export var marketQuotingDirective = "marketQuotingDirective";
Expand Down
4 changes: 2 additions & 2 deletions src/admin/market-trades.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ var MarketTradeGrid = ($scope: MarketTradeScope,

$scope.$on('$destroy', () => {
sub.disconnect();
// $log.info("destroy market trade grid");
$log.info("destroy market trade grid");
});

// $log.info("started market trade grid");
$log.info("started market trade grid");
};

export var marketTradeDirective = "marketTradeDirective";
Expand Down
4 changes: 2 additions & 2 deletions src/admin/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ var MessagesController = ($scope: MessageLoggerScope, $log: ng.ILogService, subs

$scope.$on('$destroy', () => {
sub.disconnect();
// $log.info("destroy message grid");
$log.info("destroy message grid");
});

// $log.info("started message grid");
$log.info("started message grid");
};

export var messagesDirective = "messagesDirective";
Expand Down
4 changes: 2 additions & 2 deletions src/admin/orderlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ var OrderListController = ($scope: OrderListScope,

$scope.$on('$destroy', () => {
sub.disconnect();
// $log.info("destroy order list");
$log.info("destroy order list");
});

// $log.info("started order list");
$log.info("started order list");
};

var orderList = (): ng.IDirective => {
Expand Down
4 changes: 2 additions & 2 deletions src/admin/position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ var PositionController = ($scope : PositionScope, $log : ng.ILogService, subscri

$scope.$on('$destroy', () => {
positionSubscriber.disconnect();
// $log.info("destroy position grid");
$log.info("destroy position grid");
});

// $log.info("started position grid");
$log.info("started position grid");
};

export var positionDirective = "positionDirective";
Expand Down
4 changes: 2 additions & 2 deletions src/admin/target-base-position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ var TargetBasePositionController = ($scope : TargetBasePositionScope, $log : ng.

$scope.$on('$destroy', () => {
subscriber.disconnect();
// $log.info("destroy target base position");
$log.info("destroy target base position");
});

// $log.info("started target base position");
$log.info("started target base position");
};

export var targetBasePositionDirective = "targetBasePositionDirective";
Expand Down
4 changes: 2 additions & 2 deletions src/admin/trade-safety.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ var TradeSafetyController = ($scope : TradeSafetyScope, $log : ng.ILogService, s

$scope.$on('$destroy', () => {
subscriber.disconnect();
// $log.info("destroy trade safety");
$log.info("destroy trade safety");
});

// $log.info("started trade safety");
$log.info("started trade safety");
};

export var tradeSafetyDirective = "tradeSafetyDirective";
Expand Down
4 changes: 2 additions & 2 deletions src/admin/trades.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ var TradesListController = ($scope : TradesScope, $log : ng.ILogService, subscri
$scope.$on('$destroy', () => {
sub.disconnect();
qpSub.disconnect();
// $log.info("destroy trades list");
$log.info("destroy trades list");
});

// $log.info("started trades list");
$log.info("started trades list");
};

var tradeList = () : ng.IDirective => {
Expand Down
32 changes: 16 additions & 16 deletions src/common/messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ export class Publisher<T> implements IPublish<T> {
this.registerSnapshot(snapshot || null);

var onConnection = s => {
// this._log("socket", s.id, "connected for Publisher", topic);
this._log("socket", s.id, "connected for Publisher", topic);

// s.on("disconnect", () => {
// this._log("socket", s.id, "disconnected for Publisher", topic);
// });
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();
// this._log("socket", s.id, "asking for snapshot on topic", topic);
this._log("socket", s.id, "asking for snapshot on topic", topic);
s.emit(Prefixes.SNAPSHOT + "-" + topic, snapshot);
}
});
Expand Down Expand Up @@ -84,7 +84,7 @@ export class Subscriber<T> implements ISubscribe<T> {
private _log : (...args: any[]) => void) {
this._socket = io;

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

if (this.connected)
this.onConnect();
Expand All @@ -100,7 +100,7 @@ export class Subscriber<T> implements ISubscribe<T> {
}

private onConnect = () => {
// this._log("connect to", this.topic);
this._log("connect to", this.topic);
if (this._connectHandler !== null) {
this._connectHandler();
}
Expand All @@ -109,7 +109,7 @@ export class Subscriber<T> implements ISubscribe<T> {
};

private onDisconnect = () => {
// this._log("disconnected from", this.topic);
this._log("disconnected from", this.topic);
if (this._disconnectHandler !== null)
this._disconnectHandler();
};
Expand All @@ -120,13 +120,13 @@ export class Subscriber<T> implements ISubscribe<T> {
};

private onSnapshot = (msgs : T[]) => {
// this._log("handling snapshot for", this.topic, "nMsgs:", msgs.length);
this._log("handling snapshot for", this.topic, "nMsgs:", msgs.length);
if (this._snapshotHandler !== null)
this._snapshotHandler(msgs);
};

public disconnect = () => {
// this._log("forcing disconnection from ", this.topic);
this._log("forcing disconnection from ", this.topic);
this._socket.off("connect", this.onConnect);
this._socket.off("disconnect", this.onDisconnect);
this._socket.off(Prefixes.MESSAGE + "-" + this.topic, this.onIncremental);
Expand Down Expand Up @@ -183,8 +183,8 @@ export class Fire<T> implements IFire<T> {

constructor(private topic : string, io : SocketIOClient.Socket, _log : (...args: any[]) => void) {
this._socket = io;
// this._socket.on("connect", () => _log("Fire connected to", this.topic))
// .on("disconnect", () => _log("Fire disconnected to", this.topic));
this._socket.on("connect", () => _log("Fire connected to", this.topic))
.on("disconnect", () => _log("Fire disconnected to", this.topic));
}

public fire = (msg : T) : void => {
Expand All @@ -205,14 +205,14 @@ export class Receiver<T> implements IReceive<T> {
constructor(private topic : string, io : SocketIO.Server,
private _log : (...args: any[]) => void) {
var onConnection = (s : SocketIO.Socket) => {
// this._log("socket", s.id, "connected for Receiver", topic);
this._log("socket", s.id, "connected for Receiver", topic);
s.on(Prefixes.MESSAGE + "-" + this.topic, msg => {
if (this._handler !== null)
this._handler(msg);
});
// s.on("error", e => {
// _log("error in Receiver", e.stack, e.message);
// });
s.on("error", e => {
_log("error in Receiver", e.stack, e.message);
});
};

io.on("connection", onConnection);
Expand Down
4 changes: 2 additions & 2 deletions src/service/broker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class OrderBroker implements Interfaces.IOrderBroker {
// race condition! i cannot cancel an order before I get the exchangeId (oid); register it for deletion on the ack
if (typeof rpt.exchangeId === "undefined") {
this._cancelsWaitingForExchangeOrderId[rpt.orderId] = cancel;
/////this._log.info("Registered %s for late deletion", rpt.orderId);
this._log.info("Registered %s for late deletion", rpt.orderId);
return;
}
}
Expand Down Expand Up @@ -350,7 +350,7 @@ export class OrderBroker implements Interfaces.IOrderBroker {
if (!this._oeGateway.cancelsByClientOrderId
&& typeof o.exchangeId !== "undefined"
&& o.orderId in this._cancelsWaitingForExchangeOrderId) {
/////this._log.info("Deleting %s late, oid: %s", o.exchangeId, o.orderId);
this._log.info("Deleting %s late, oid: %s", o.exchangeId, o.orderId);
var cancel = this._cancelsWaitingForExchangeOrderId[o.orderId];
delete this._cancelsWaitingForExchangeOrderId[o.orderId];
this.cancelOrder(cancel);
Expand Down
8 changes: 4 additions & 4 deletions src/service/persister.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class RepositoryPersister<T extends Persistable> implements ILoadLatest<T
public persist = (report: T) => {
this._saver(report);
this.collection.then(coll => {
if (["qp-sub"].indexOf(this._dbName)>-1)
if (this._dbName != 'trades')
coll.deleteMany({ _id: { $exists:true } }, err => {
if (err)
this._log.error(err, "Unable to deleteMany", this._dbName, report);
Expand Down Expand Up @@ -136,9 +136,9 @@ export class Persister<T extends Persistable> implements ILoadAll<T> {

public loadAll = (limit?: number, start_time?: moment.Moment): Q.Promise<T[]> => {
var selector = { exchange: this._exchange, pair: this._pair };
/*if (start_time) {
if (this._dbName != "trades" && start_time) {
selector["time"] = { $gte: start_time.toDate() };
}*/
}

return this.loadInternal(selector, limit);
};
Expand Down Expand Up @@ -176,7 +176,7 @@ export class Persister<T extends Persistable> implements ILoadAll<T> {
public persist = (report: T) => {
this.collection.then(coll => {
this._saver(report);
if (["fv","md","msg","mt","pos","tbp","osr","tsv"].indexOf(this._dbName)>-1)
if (this._dbName != 'trades')
coll.deleteMany({ time: { $exists:true } }, err => {
if (err)
this._log.error(err, "Unable to deleteMany", this._dbName, report);
Expand Down
4 changes: 2 additions & 2 deletions src/service/quoting-parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Repository<T> implements Interfaces.IRepository<T> {
private _rec: Messaging.IReceive<T>,
private _pub: Messaging.IPublish<T>) {

//this._log.info("Starting parameter:", defaultParameter);
this._log.info("Starting parameter:", defaultParameter);
_pub.registerSnapshot(() => [this.latest]);
_rec.registerReceiver(this.updateParameters);
this._latest = defaultParameter;
Expand All @@ -37,7 +37,7 @@ class Repository<T> implements Interfaces.IRepository<T> {
public updateParameters = (newParams: T) => {
if (this._validator(newParams) && this._paramsEqual(newParams, this._latest)) {
this._latest = newParams;
//this._log.info("Changed parameters", this.latest);
this._log.info("Changed parameters", this.latest);
this.NewParameters.trigger();
}

Expand Down
2 changes: 0 additions & 2 deletions src/service/quoting-styles/top-join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ function computeInverseJoinQuote(filteredMkt: Models.Market, fv: Models.FairValu
return genQt;
}

//computePingPongQuote is same as computeTopJoinQuote but need to use params.mode === Models.QuotingMode.PingPong
function computePingPongQuote(filteredMkt: Models.Market, fv: Models.FairValue, params: Models.QuotingParameters) {
var genQt = getQuoteAtTopOfMarket(filteredMkt, params);

Expand All @@ -135,7 +134,6 @@ function computePingPongQuote(filteredMkt: Models.Market, fv: Models.FairValue,
return genQt;
}

//computeBoomerangQuote is same as computeTopJoinQuote but need to use params.mode === Models.QuotingMode.PingPong
function computeBoomerangQuote(filteredMkt: Models.Market, fv: Models.FairValue, params: Models.QuotingParameters) {
var genQt = getQuoteAtTopOfMarket(filteredMkt, params);

Expand Down
2 changes: 1 addition & 1 deletion src/service/statistics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class ObservableEWMACalculator implements Interfaces.IEwmaCalculator {
this._latest = v;
this.Updated.trigger();

////this._log.info("New EMWA value", this._latest);
this._log.info("New EMWA value", this._latest);
}
};

Expand Down

0 comments on commit 54ab3f6

Please sign in to comment.