noda-sin / ebisu

Bitmex Simple and Powerful Trading Bot
MIT License
83 stars 32 forks source link

TV Strategy doesn't work #8

Open Lucky21110 opened 5 years ago

Lucky21110 commented 5 years ago

image

Hello,

I have setup everyting and I have placed file as the documentation say image

How I can troubleshoot ?

Regards

haikalfouzi commented 4 years ago
if subject.startswith('TradingViewアラート:'):
action = subject.replace('TradingViewアラート:', '')
self.__action(action)

change this text TradingViewアラート: to TradingView Alert: in strategy.py

haikalfouzi commented 3 years ago

@noda-sin Seems like tradingview strategy doesn't work and the get_messages function in gmail_sub.py was stucked in loop and didn't return result to on_message function in strategy.py Screenshot 2021-01-17 at 6 35 03 PM i've added logger.info in all def function in gmail_sub.py just to check if there's any function stuck in loop

haikalfouzi commented 3 years ago

i've found a fix for why tradingview strategy doesn't work. You have to modify epoch search time by reducing it by 1 second.

Edit __get_messages function in gmail_sub.py

def __get_messages(self):
        #logger.info('gmailsub __get_messages is running')
        if self.last_time is None:
            after = calendar.timegm(datetime.now(timezone.utc).timetuple()) - 1
        else:
            after = self.last_time + 1
        now = calendar.timegm(datetime.now(timezone.utc).timetuple()) - 1
        resp = get_messages_list(self.user_id,
                                 from_address=self.from_address,
                                 after=after)
        messages = []
        self.last_time = now

        if 'messages' not in resp:
            return messages
        for m in resp['messages']:
            detail = get_message_detail(m['id'], self.user_id)
            messages.append(detail)

        return messages

Screenshot 2021-01-20 at 2 01 38 AM

2021-01-20 01:51:13,968 - INFO - Bot Mode : Trade 2021-01-20 01:51:13,968 - INFO - Starting Bot 2021-01-20 01:51:13,968 - INFO - Strategy : TV 2021-01-20 01:51:22,621 - INFO - Balance : 0.00442344 XBT 2021-01-20 01:51:58,261 - INFO - ========= New Order ============== 2021-01-20 01:51:58,261 - INFO - ID : Long_YBphj/cXTAKgiXFCJQAD1A 2021-01-20 01:51:58,261 - INFO - Type : Market 2021-01-20 01:51:58,262 - INFO - Side : Buy 2021-01-20 01:51:58,262 - INFO - Qty : 329 2021-01-20 01:51:58,262 - INFO - Limit : 0 2021-01-20 01:51:58,262 - INFO - Stop : 0 2021-01-20 01:51:58,263 - INFO - rPnl : -0.000128 XBT 2021-01-20 01:51:58,263 - INFO - ====================================== 2021-01-20 01:52:16,231 - INFO - Close Position : (orderID, orderType, side, orderQty, limit, stop) = (f31d1d34-8269-414b-a617-ce1cd90aafd9, Market, Sell, 329, 37273.5, None) 2021-01-20 01:52:16,232 - INFO - Close All Position 2021-01-20 01:52:18,853 - INFO - Close Position : (orderID, orderType, side, orderQty, limit, stop) = (072c56af-bf29-45c8-b651-736a71b2cf09, Market, , None, None, None) 2021-01-20 01:52:18,853 - INFO - Close All Position