Skip to content

Commit

Permalink
add EasyTraderOrderBroker
Browse files Browse the repository at this point in the history
  • Loading branch information
fasiondog committed Jan 29, 2024
1 parent 1232918 commit 0a4a12d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hikyuu/trade_manage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
from .trade import *
from .broker import OrderBrokerBase, OrderBrokerWrap, TestOrderBroker, crtOB
from .broker_mail import MailOrderBroker

from .broker_easytrader import EasyTraderOrderBroker
17 changes: 17 additions & 0 deletions hikyuu/trade_manage/broker_easytrader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/#!/usr/bin/python
# -*- coding: utf8 -*-
#
# Create on: 2024-01-30
# Author: fasiondog

class EasyTraderOrderBroker:
def __init__(self, user):
self.user = user

def buy(self, code, price, num):
self.user.buy(code[2:], price=price, amount=num)
print("买入:%s %.3f %i" % (code, price, num))

def sell(self, code, price, num):
self.user.sell(code[2:], price=price, amount=num)
print("卖出:%s %.3f %i" % (code, price, num))

0 comments on commit 0a4a12d

Please sign in to comment.