From 0e8590c35c1cc2fcc4601d5d5a6d89ab1dcb33bd Mon Sep 17 00:00:00 2001 From: khwkim1111 Date: Sat, 9 May 2026 12:29:22 +0900 Subject: [PATCH] add: bot bond selling --- bot bond sell.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/bot bond sell.py b/bot bond sell.py index 3371076..ecb6d45 100644 --- a/bot bond sell.py +++ b/bot bond sell.py @@ -44,7 +44,7 @@ def main(): # pick? Also, you will need to send more orders over time. # --- BOND 마켓 메이킹 설정 --- FAIR_VALUE = 1000 # BOND fair value (고정) - ORDER_SIZE = 10 # 주문당 수량 + ORDER_SIZE = 10 # 주문당 기본 수량 MAX_POSITION = 100 # 최대 포지션 한도 REFRESH_INTERVAL = 5.0 # 주문 갱신 주기 (초) @@ -71,15 +71,25 @@ def main(): cancel_all_bond_orders() - # 포지션이 음수면 매수 가격을 올려서 빨리 사들임 - # 포지션이 양수면 매도 가격을 내려서 빨리 팖 - skew = position // 10 # 포지션 10마다 1틱 조정 + buy_price = FAIR_VALUE - 1 # 999 + sell_price = FAIR_VALUE + 1 # 1001 - buy_price = min(FAIR_VALUE - 1 + skew, FAIR_VALUE - 1) # 최대 999 - sell_price = max(FAIR_VALUE + 1 + skew, FAIR_VALUE + 1) # 최소 1001 + # 포지션이 음수일수록 매수 size 크게, 매도 size 작게 + # 포지션이 양수일수록 매도 size 크게, 매수 size 작게 + base_size = ORDER_SIZE + adjustment = abs(position) // 5 # 포지션 5마다 1씩 조정 - buy_size = min(ORDER_SIZE, MAX_POSITION - position) - sell_size = min(ORDER_SIZE, MAX_POSITION + position) + if position < 0: + # 숏 포지션 → 매수를 더 많이 + buy_size = min(base_size + adjustment, MAX_POSITION - position) + sell_size = max(base_size - adjustment, 1) + elif position > 0: + # 롱 포지션 → 매도를 더 많이 + buy_size = max(base_size - adjustment, 1) + sell_size = min(base_size + adjustment, MAX_POSITION + position) + else: + buy_size = base_size + sell_size = base_size if buy_size > 0: bid = next_id() @@ -322,4 +332,4 @@ if __name__ == "__main__": "Please put your team name in the variable [team_name]." ) - main() + main() \ No newline at end of file