# Path: zaifbot/trade/tools.py
# def last_price(currency_pair, *, timestamp=None):
#     if timestamp is None:
#         return get_latest_price(currency_pair)
# 
#     candle_sticks = CandleSticks(currency_pair, '1m')
#     return candle_sticks.last_price(timestamp)
# 
# Path: zaifbot/rules/entry/base.py
# class Entry(Rule):
#     def __init__(self, currency_pair, amount, action='bid', name=None):
#         self.currency_pair = CurrencyPair(currency_pair)
#         self.amount = amount
#         self.action = Action(action)
#         self.name = name or self.__class__.__name__
# 
#     def can_entry(self, *args, **kwargs):
#         raise NotImplementedError
# 
#     def entry(self, trade):
#         trade.entry(currency_pair=self.currency_pair,
#                     amount=self.amount,
#                     action=self.action)
# 
#         return trade


from zaifbot.trade.tools import last_price
from zaifbot.rules.entry.base import Entry


class SellHigherEntry(Entry):
    def __init__(self, currency_pair, amount, sell_price, name=None):
        super().__init__(currency_pair=currency_pair, amount=amount, action='ask', name=name)
        self.sell_price = sell_price

    def can_entry(self):

# Path: zaifbot/trade/tools.py
# def last_price(currency_pair, *, timestamp=None):
#     if timestamp is None:
#         return get_latest_price(currency_pair)
# 
#     candle_sticks = CandleSticks(currency_pair, '1m')
#     return candle_sticks.last_price(timestamp)
# 
# Path: zaifbot/rules/entry/base.py
# class Entry(Rule):
#     def __init__(self, currency_pair, amount, action='bid', name=None):
#         self.currency_pair = CurrencyPair(currency_pair)
#         self.amount = amount
#         self.action = Action(action)
#         self.name = name or self.__class__.__name__
# 
#     def can_entry(self, *args, **kwargs):
#         raise NotImplementedError
# 
#     def entry(self, trade):
#         trade.entry(currency_pair=self.currency_pair,
#                     amount=self.amount,
#                     action=self.action)
# 
#         return trade


# Path: zaifbot/rules/entry/sell_higher_entry.py
from zaifbot.trade.tools import last_price
from zaifbot.rules.entry.base import Entry



class SellHigherEntry(Entry):
    def __init__(self, currency_pair, amount, sell_price, name=None):
        super().__init__(currency_pair=currency_pair, amount=amount, action='ask', name=name)
        self.sell_price = sell_price

    def can_entry(self):

        return last_price(self.currency_pair) > self.sell_price