Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Closed
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
2 changes: 1 addition & 1 deletion .jest
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000
jasmine.DEFAULT_TIMEOUT_INTERVAL = 180000

process.on('unhandledRejection', e => console.log(e))
3 changes: 3 additions & 0 deletions src/botPage/bot/TradeEngine/Sell.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ let delayIndex = 0;
export default Engine =>
class Sell extends Engine {
isSellAtMarketAvailable() {
console.log('Called isSellAtMarketAvailable');
return this.contractId && !this.isSold && this.isSellAvailable && !this.isExpired;
}
sellAtMarket() {
console.log('called sellAtMarket');
// Prevent calling sell twice
if (this.store.getState().scope !== DURING_PURCHASE) {
console.log('Scope is not DURING_PURCHASE');
return Promise.resolve();
}

Expand Down
4 changes: 4 additions & 0 deletions src/botPage/bot/TradeEngine/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default class TradeEngine extends Balance(Purchase(Sell(OpenContract(Prop
this.store = createStore(rootReducer, applyMiddleware(thunk));
}
init(...args) {
console.log('Init called', args);
const [token, options] = expectInitArg(args);

const { symbol } = options;
Expand All @@ -91,6 +92,8 @@ export default class TradeEngine extends Balance(Purchase(Sell(OpenContract(Prop
throw createError('NotInitialized', translate('Bot.init is not called'));
}

console.log('Start called', tradeOptions);

globalObserver.emit('bot.running');
globalObserver.setState({ isRunning: true });

Expand Down Expand Up @@ -135,6 +138,7 @@ export default class TradeEngine extends Balance(Purchase(Sell(OpenContract(Prop
this.observeProposals();
}
watch(watchName) {
console.log('Watching', watchName);
if (watchName === 'before') {
return watchBefore(this.store);
}
Expand Down
1 change: 1 addition & 0 deletions src/botPage/bot/__tests__/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const parts = {
`,
waitToSell: `
while (watch('during')) {
console.log('Attempting to sell...', Date.now());
if (Bot.isSellAvailable()) {
Bot.sellAtMarket();
}
Expand Down