Skip to content

Commit

Permalink
Rename function to handle order in API
Browse files Browse the repository at this point in the history
  • Loading branch information
anxolin committed Sep 12, 2023
1 parent 3036a29 commit 1d77252
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/composable/ConditionalOrder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jest.mock('./contracts')
jest.mock('../order-book/api', () => {
return {
OrderBookApi: class MockedOrderBookApi {
getOrder = mockGetOrder //jest.fn(),
getOrder = mockGetOrder
},
}
})
Expand Down
8 changes: 4 additions & 4 deletions src/composable/ConditionalOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export abstract class ConditionalOrder<D, S> {

// Let the concrete Conditional Order decide about the poll result (in the case the order is already in the orderbook)
if (isOrderInOrderbook) {
const pollResult = await this.polledOrderInOrderbook(orderUid, order, params)
const pollResult = await this.handlePollFailedAlreadyPresent(orderUid, order, params)
if (pollResult) {
return pollResult
}
Expand Down Expand Up @@ -363,14 +363,14 @@ export abstract class ConditionalOrder<D, S> {
protected abstract pollValidate(params: PollParams): Promise<PollResultErrors | undefined>

/**
* This method lets the concrete conditional order decide what to do if the order yielded in the polling has been already created.
* This method lets the concrete conditional order decide what to do if the order yielded in the polling is already present in the Orderbook API.
*
* The concrete conditional order will have a chance to schedule the next poll.
* For example, a TWAP order that has the current part already in the orderbook, can signal that the next poll should be done at the time of the next part.
* For example, a TWAP order that has the current part already in the orderbook, can signal that the next poll should be done at the start time of the next part.
*
* @param params
*/
protected abstract polledOrderInOrderbook(
protected abstract handlePollFailedAlreadyPresent(
orderUid: UID,
order: GPv2Order.DataStructOutput,
params: PollParams
Expand Down
2 changes: 1 addition & 1 deletion src/composable/orderTypes/Twap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export class Twap extends ConditionalOrder<TwapData, TwapStruct> {
return undefined
}

protected async polledOrderInOrderbook(
protected async handlePollFailedAlreadyPresent(
_orderUid: string,

Check warning on line 355 in src/composable/orderTypes/Twap.ts

View workflow job for this annotation

GitHub Actions / eslint

'_orderUid' is defined but never used
_order: GPv2Order.DataStructOutput,

Check warning on line 356 in src/composable/orderTypes/Twap.ts

View workflow job for this annotation

GitHub Actions / eslint

'_order' is defined but never used
_params: PollParams

Check warning on line 357 in src/composable/orderTypes/Twap.ts

View workflow job for this annotation

GitHub Actions / eslint

'_params' is defined but never used
Expand Down
2 changes: 1 addition & 1 deletion src/composable/orderTypes/test/TestConditionalOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class TestConditionalOrder extends ConditionalOrder<string, string> {
protected async pollValidate(_params: PollParams): Promise<PollResultErrors | undefined> {
return undefined
}
protected async polledOrderInOrderbook(
protected async handlePollFailedAlreadyPresent(
_orderUid: string,
_order: GPv2Order.DataStructOutput,
_params: PollParams
Expand Down

0 comments on commit 1d77252

Please sign in to comment.