pyalgotrade源码阅读:时区的设定marketsession.py

"""
.. moduleauthor:: Gabriel Martin Becedillas Ruiz <[email protected]>
"""

## 已读,市场的时区

import pytz


# http://en.wikipedia.org/wiki/List_of_market_opening_times
class MarketSession(object):
    """Base class for market sessions.

    .. note::
        This is a base class and should not be used directly.
    """

    @classmethod
    def getTimezone(cls):
        """Returns the pytz timezone for the market session."""
        return cls.timezone


######################################################################
# US

class NASDAQ(MarketSession):
    """NASDAQ market session."""
    timezone = pytz.timezone("US/Eastern")


class NYSE(MarketSession):
    """New York Stock Exchange market session."""
    timezone = pytz.timezone("US/Eastern")


class USEquities(MarketSession):
    """US Equities market session."""
    timezone = pytz.timezone("US/Eastern")


######################################################################
# South America

class MERVAL(MarketSession):
    """Buenos Aires (Argentina) market session."""
    timezone = pytz.timezone("America/Argentina/Buenos_Aires")


class BOVESPA(MarketSession):
    """BOVESPA (Brazil) market session."""
    timezone = pytz.timezone("America/Sao_Paulo")


######################################################################
# Europe

class FTSE(MarketSession):
    """ London Stock Exchange market session."""
    timezone = pytz.timezone("Europe/London")


######################################################################
# Asia

class TSE(MarketSession):
    """Tokyo Stock Exchange market session."""
    timezone = pytz.timezone("Asia/Tokyo")

猜你喜欢

转载自blog.csdn.net/qq_26948675/article/details/84544861
今日推荐