Skip to content

Commit d712841

Browse files
committed
정리: 로컬 폴더를 지우기 전 남아 있던 작업 변경을 저장함
1 parent c742484 commit d712841

22 files changed

Lines changed: 4914 additions & 69 deletions

‎.github/workflows/publish.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ jobs:
4646
- name: Install build tools
4747
run: |
4848
python -m pip install --upgrade pip
49-
pip install build
49+
pip install build twine
5050
5151
- name: Build package
52-
run: python -m build
52+
run: |
53+
python -m build
54+
python -m twine check dist/*.whl dist/*.tar.gz
5355
5456
- name: Publish to PyPI
5557
uses: pypa/gh-action-pypi-publish@release/v1

‎.github/workflows/test.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ jobs:
2525
run: |
2626
python -m pip install --upgrade pip
2727
pip install -e ".[dev]"
28+
pip install build twine
2829
2930
- name: Run tests
3031
run: pytest
32+
33+
- name: Verify package build
34+
run: |
35+
python -m build
36+
python -m twine check dist/*.whl dist/*.tar.gz

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 eddmpython
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎__init__.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
from tradix.entities import Order, OrderSide, OrderType, TimeInForce, Position, Trade, Bar
6565
from tradix.events import Event, MarketEvent, SignalEvent, OrderEvent, FillEvent
6666
from tradix.strategy import Strategy, Indicators
67-
from tradix.portfolio import Portfolio
67+
from tradix.portfolio import Portfolio, TradeLedger
6868
from tradix.engine import BacktestEngine, BacktestResult
6969
from tradix.optimize import Optimizer, ParameterSpace, OptimizeResult
7070
from tradix.walkforward import WalkForwardAnalyzer, WalkForwardResult, PeriodSplitter
@@ -226,7 +226,7 @@
226226
plotSeasonality,
227227
)
228228

229-
__version__ = "1.0.0"
229+
__version__ = str(CURRENT_VERSION)
230230

231231
__all__ = [
232232
# Version
@@ -319,6 +319,7 @@
319319
"Strategy",
320320
"Indicators",
321321
"Portfolio",
322+
"TradeLedger",
322323

323324
# Entities
324325
"Order",

‎broker/simulator.py‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from tradix.events.fill import FillEvent
2828
from tradix.broker.commission import CommissionModel, KoreaStockCommission
2929
from tradix.broker.slippage import SlippageModel, PercentSlippage
30-
from tradix.broker.fill import FillModel, CloseFill
30+
from tradix.broker.fill import FillModel, CloseFill, OpenFill
3131

3232

3333
@dataclass
@@ -89,7 +89,33 @@ def processOrder(self, order: Order, bar: Bar) -> FillEvent:
8989
commission, and slippage details. Returns zero-filled
9090
event if fill price is non-positive.
9191
"""
92-
basePrice = self.fillModel.getFillPrice(order, bar)
92+
return self._processWithFillModel(order, bar, self.fillModel)
93+
94+
def processOrderAtOpen(self, order: Order, bar: Bar) -> FillEvent:
95+
"""
96+
Process an order using the bar's opening price.
97+
98+
BacktestEngine fills queued market orders on the next bar's open to
99+
prevent look-ahead bias. This method gives BrokerSimulator the same
100+
contract as the legacy SimpleBroker used by the engine.
101+
102+
Args:
103+
order (Order): The order to execute. 실행할 주문.
104+
bar (Bar): Current bar data for price reference. 현재 바 데이터.
105+
106+
Returns:
107+
FillEvent: Fill generated from the bar's open price.
108+
"""
109+
return self._processWithFillModel(order, bar, OpenFill())
110+
111+
def _processWithFillModel(
112+
self,
113+
order: Order,
114+
bar: Bar,
115+
fillModel: FillModel,
116+
) -> FillEvent:
117+
"""Generate a fill event using the supplied fill model."""
118+
basePrice = fillModel.getFillPrice(order, bar)
93119

94120
if basePrice <= 0:
95121
return FillEvent(

0 commit comments

Comments
 (0)