本文整理汇总了Python中messenger.Messenger.send_sell_gmail方法的典型用法代码示例。如果您正苦于以下问题:Python Messenger.send_sell_gmail方法的具体用法?Python Messenger.send_sell_gmail怎么用?Python Messenger.send_sell_gmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类messenger.Messenger
的用法示例。
在下文中一共展示了Messenger.send_sell_gmail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Trader
# 需要导入模块: from messenger import Messenger [as 别名]
# 或者: from messenger.Messenger import send_sell_gmail [as 别名]
#.........这里部分代码省略.........
self.Messenger.print_buy(coin_pair, price, stats["rsi"], stats["24HrVolume"])
self.Messenger.send_buy_slack(coin_pair, stats["rsi"], stats["24HrVolume"])
self.Messenger.send_buy_gmail(buy_order_data["result"], stats)
self.Messenger.play_sw_imperial_march()
def sell(self, coin_pair, price, stats, trade_time_limit=2):
"""
Used to place a sell order to Bittrex. Wait until the order is completed.
If the order is not filled within trade_time_limit minutes cancel it.
:param coin_pair: String literal for the market (ex: BTC-LTC)
:type coin_pair: str
:param price: The price at which to buy
:type price: float
:param stats: The buy stats object
:type stats: dict
:param trade_time_limit: The time in minutes to wait fot the order before cancelling it
:type trade_time_limit: float
"""
trade = self.Database.get_open_trade(coin_pair)
sell_data = self.Bittrex.sell_limit(coin_pair, trade["quantity"], price)
if not sell_data["success"]:
return logger.error(
"Failed to sell on {} market. Bittrex error message: {}".format(coin_pair, sell_data["message"])
)
sell_order_data = self.get_order(sell_data["result"]["uuid"], trade_time_limit * 60)
# TODO: Handle partial/incomplete sales.
self.Database.store_sell(sell_order_data["result"], stats)
self.Messenger.print_sell(coin_pair, price, stats["rsi"], stats["profitMargin"])
self.Messenger.send_sell_slack(coin_pair, stats["rsi"], stats["profitMargin"])
self.Messenger.send_sell_gmail(sell_order_data["result"], stats)
self.Messenger.play_sw_theme()
def get_markets(self, main_market_filter=None):
"""
Gets all the Bittrex markets and filters them based on the main market filter
:param main_market_filter: Main market to filter on (ex: BTC, ETH, USDT)
:type main_market_filter: str
:return: All Bittrex markets (with filter applied, if any)
:rtype : list
"""
markets = self.Bittrex.get_markets()
if not markets["success"]:
logger.error("Failed to fetch Bittrex markets")
exit()
markets = markets["result"]
if main_market_filter is not None:
market_check = main_market_filter + "-"
markets = py_.filter_(markets, lambda market: market_check in market["MarketName"])
markets = py_.map_(markets, lambda market: market["MarketName"])
return markets
def get_current_price(self, coin_pair, price_type):
"""
Gets current market price for a coin pair
:param coin_pair: Coin pair market to check (ex: BTC-ETH, BTC-FCT)
:type coin_pair: str
:param price_type: The type of price to get (one of: 'ask', 'bid')
:type price_type: str