-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i honestly don't think this code needs refactoring
- Loading branch information
1 parent
f5c1737
commit 536c2cd
Showing
8 changed files
with
168 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
TinyME_v2.0/src/main/java/ir/ramtung/tinyme/domain/service/controls/ControlResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package ir.ramtung.tinyme.domain.service.controls; | ||
|
||
public enum ControlResult { | ||
OK, | ||
NOT_ENOUGH_POSITION, | ||
NOT_ENOUGH_CREDIT, | ||
NOT_ENOUGH_EXECUTION | ||
OK, | ||
NOT_ENOUGH_POSITION, | ||
NOT_ENOUGH_CREDIT, | ||
NOT_ENOUGH_EXECUTION, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 43 additions & 49 deletions
92
TinyME_v2.0/src/main/java/ir/ramtung/tinyme/domain/service/controls/MatchingControl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,51 @@ | ||
package ir.ramtung.tinyme.domain.service.controls; | ||
|
||
import java.util.List; | ||
|
||
import ir.ramtung.tinyme.domain.entity.Order; | ||
import ir.ramtung.tinyme.domain.entity.OrderBook; | ||
import ir.ramtung.tinyme.domain.entity.Trade; | ||
import java.util.List; | ||
|
||
public abstract class MatchingControl { | ||
protected PositionControl positionControl; | ||
protected CreditControl creditControl; | ||
protected QuantityControl quantityControl; | ||
|
||
public MatchingControl(PositionControl positionControl, CreditControl creditControl, QuantityControl quantityControl) { | ||
this.positionControl = positionControl; | ||
this.creditControl = creditControl; | ||
this.quantityControl = quantityControl; | ||
} | ||
|
||
public ControlResult checkBeforeMatching(Order targetOrder, OrderBook orderBook) { | ||
return ControlResult.OK; | ||
} | ||
|
||
public void actionAtBeforeMatching(Order targetOrder, OrderBook orderBook) { | ||
|
||
} | ||
|
||
public void actionAtFailedBeforeMatching(Order targetOrder, OrderBook orderBook) { | ||
|
||
} | ||
|
||
public ControlResult checkBeforeMatch(Trade trade) { | ||
return ControlResult.OK; | ||
} | ||
|
||
public void actionAtMatch(Trade trade, OrderBook orderBook) { | ||
creditControl.updateCreditsAtTrade(trade); | ||
quantityControl.updateQuantitiesAtTrade(trade, orderBook); | ||
positionControl.updatePositionsAtTrade(trade); | ||
} | ||
|
||
public void actionAtFailedBeforeMatch(List<Trade> trades, OrderBook orderBook) { | ||
|
||
} | ||
|
||
public ControlResult checkAfterMatching(Order targetOrder, List<Trade> trades) { | ||
return ControlResult.OK; | ||
} | ||
|
||
public void actionAtAfterMatching(Order targetOrder, OrderBook orderBook) { | ||
|
||
} | ||
|
||
public void actionAtfailedAfterMatching(List<Trade> trades, OrderBook orerrBook) { | ||
|
||
} | ||
|
||
protected PositionControl positionControl; | ||
protected CreditControl creditControl; | ||
protected QuantityControl quantityControl; | ||
|
||
public MatchingControl( | ||
PositionControl positionControl, | ||
CreditControl creditControl, | ||
QuantityControl quantityControl | ||
) { | ||
this.positionControl = positionControl; | ||
this.creditControl = creditControl; | ||
this.quantityControl = quantityControl; | ||
} | ||
|
||
public ControlResult checkBeforeMatching(Order targetOrder, OrderBook orderBook) { | ||
return ControlResult.OK; | ||
} | ||
|
||
public void actionAtBeforeMatching(Order targetOrder, OrderBook orderBook) {} | ||
|
||
public void actionAtFailedBeforeMatching(Order targetOrder, OrderBook orderBook) {} | ||
|
||
public ControlResult checkBeforeMatch(Trade trade) { | ||
return ControlResult.OK; | ||
} | ||
|
||
public void actionAtMatch(Trade trade, OrderBook orderBook) { | ||
creditControl.updateCreditsAtTrade(trade); | ||
quantityControl.updateQuantitiesAtTrade(trade, orderBook); | ||
positionControl.updatePositionsAtTrade(trade); | ||
} | ||
|
||
public void actionAtFailedBeforeMatch(List<Trade> trades, OrderBook orderBook) {} | ||
|
||
public ControlResult checkAfterMatching(Order targetOrder, List<Trade> trades) { | ||
return ControlResult.OK; | ||
} | ||
|
||
public void actionAtAfterMatching(Order targetOrder, OrderBook orderBook) {} | ||
|
||
public void actionAtfailedAfterMatching(List<Trade> trades, OrderBook orerrBook) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.