예제 #1
0
    def _init_app(self):
        #itrade_logging.setLevel(logging.DEBUG)
        #print '--- load current portfolio ---'
        portfolio = loadPortfolio()
        #print 'Portfolio : %s:%s:%s:%s:%f ' % (portfolio.filename(), portfolio.name(), portfolio.accountref(), portfolio.market(), portfolio.vat())

        print '--- build a matrix -----------'
        matrix = createMatrix(portfolio.filename(), portfolio)

        frame = iTradeMainWindow(None, portfolio, matrix)
        self.SetTopWindow(frame)
예제 #2
0
    def _init_app(self):
        #itrade_logging.setLevel(logging.DEBUG)
        #print '--- load current portfolio ---'
        portfolio = loadPortfolio()
        #print 'Portfolio : %s:%s:%s:%s:%f ' % (portfolio.filename(), portfolio.name(), portfolio.accountref(), portfolio.market(), portfolio.vat())

        print '--- build a matrix -----------'
        matrix = createMatrix(portfolio.filename(), portfolio)

        frame = iTradeMainWindow(None, portfolio, matrix)
        self.SetTopWindow(frame)
예제 #3
0
    def __init__(self,app):
        bmp = wx.Image(os.path.join(itrade_config.dirRes, "itrade.jpg")).ConvertToBitmap()
        wx.SplashScreen.__init__(self,bmp,wx.SPLASH_CENTRE_ON_SCREEN,0,None,-1)
        wx.EVT_CLOSE(self,self.OnClose)

        thread.start_new_thread(self.Run,())

        print '--- load current portfolio ---'
        self.m_portfolio = loadPortfolio()
        print 'Portfolio : %s:%s:%s:%s:%f ' % (self.m_portfolio.filename(),self.m_portfolio.name(),self.m_portfolio.accountref(),self.m_portfolio.market(),self.m_portfolio.vat())

        print '--- build a matrix -----------'
        self.m_matrix = createMatrix(self.m_portfolio.filename(),self.m_portfolio)

        self.m_frame = iTradeMainWindow(None,self.m_portfolio,self.m_matrix)
        app.SetTopWindow(self.m_frame)
예제 #4
0
    def __init__(self, app):
        bmp = wx.Image(os.path.join(itrade_config.dirRes,
                                    "itrade.jpg")).ConvertToBitmap()
        wx.SplashScreen.__init__(self, bmp, wx.SPLASH_CENTRE_ON_SCREEN, 0,
                                 None, -1)
        wx.EVT_CLOSE(self, self.OnClose)

        thread.start_new_thread(self.Run, ())

        print '--- load current portfolio ---'
        self.m_portfolio = loadPortfolio()
        print 'Portfolio : %s:%s:%s:%s:%f ' % (
            self.m_portfolio.filename(), self.m_portfolio.name(),
            self.m_portfolio.accountref(), self.m_portfolio.market(),
            self.m_portfolio.vat())

        print '--- build a matrix -----------'
        self.m_matrix = createMatrix(self.m_portfolio.filename(),
                                     self.m_portfolio)

        self.m_frame = iTradeMainWindow(None, self.m_portfolio, self.m_matrix)
        app.SetTopWindow(self.m_frame)
예제 #5
0
def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], "xeho:vt:iq:f:l:du:", ["verbose","help", "output=", "ticker=", "quote=","file=","lang=","user="******"nopsyco","nowxversion"])
    except getopt.GetoptError:
        # print help information and exit:
        usage()
        sys.exit(2)

    # default values
    output = None
    quote = None
    file = None
    wx = True
    nopsyco = False
    nowxversion = False;

    vticker = None
    vquote  = None

    lang = gMessage.getAutoDetectedLang('us')
    for o, a in opts:

        if o == "-d":
            itrade_config.setDisconnected(True)

        if o == "-v" or o == "--verbose":
            itrade_config.verbose = True
            print 'Verbose mode : ON'

        if o == "-x":
            itrade_config.experimental = True

        if o == "-e":
            itrade_portfolio.cmdline_evaluatePortfolio()
            wx = False

        if o == "-i":
            if quote:
                if file:
                    itrade_import.cmdline_importQuoteFromFile(quote,file)
                else:
                    itrade_import.cmdline_importQuoteFromInternet(quote)
            else:
                matrix = itrade_matrix.createMatrix()
                if file:
                    itrade_import.cmdline_importMatrixFromFile(matrix,file)
                else:
                    itrade_import.cmdline_importMatrixFromInternet(matrix)
            wx = False

        if o == "-h" or o == "--help":
            usage()
            sys.exit()

        if o == "-o" or o == "--output":
            output = a

        if o == "-u" or o == "--user":
            itrade_config.dirUserData = a
            if not os.path.exists(itrade_config.dirUserData):
                print 'userdata folder %s not found !' % a
                sys.exit()

        if o  == "--nopsyco":
            nopsyco = True

        if o  == "--nowxversion":
            itrade_config.nowxversion = True

        if o == "-f" or o == "--file":
            file = a

        if o == "-l" or o == "--lang":
            lang = a
            itrade_config.lang = 255

        if o == "-t" or o == "--ticker":
            vticker = a

        if o == "-q" or o == "--quote":
            vquote = a

    # Import Psyco if available
    if not nopsyco:
        try:
            import psyco
            psyco.full()
            print 'Psyco is running'
        except ImportError:
            print 'Psyco is not running (library not found)'
    else:
        print 'Psyco is not running (forced by command line)'

    # load configuration
    itrade_config.loadConfig("itrade.py")
    if itrade_config.verbose:
        print "*** Proxy server:",itrade_config.proxyHostname, "- Proxy auth:",itrade_config.proxyAuthentication,"- Connection timeout:",itrade_config.connectionTimeout

    # load extensions
    itrade_ext.loadExtensions(itrade_config.fileExtData,itrade_config.dirExtData)

    # init modules
    itrade_quotes.initQuotesModule()
    itrade_portfolio.initPortfolioModule()

    # use the correct pack language
    if itrade_config.lang == 255:
        gMessage.setLang(lang)
        gMessage.load()

    # commands
    if vticker:
        quote = itrade_quotes.quotes.lookupTicker(vticker)
        if not quote:
            print 'ticker %s not found !' % vticker
            sys.exit()

    if vquote:
        quote = itrade_quotes.quotes.lookupKey(vquote)
        if not quote:
            print 'quote %s not found ! format is : <ISINorTICKER>.<EXCHANGE>.<PLACE>' % vquote
            sys.exit()

    if wx:
        import itrade_wxmain
        itrade_wxmain.start_iTradeWindow()

    if quote:
        portfolio = itrade_portfolio.loadPortfolio()
        quote.update()
        quote.compute()
        quote.printInfo()
예제 #6
0
파일: itrade.py 프로젝트: wjssx/itrade
def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], "xeho:vt:iq:f:l:du:", ["verbose","help", "output=", "ticker=", "quote=","file=","lang=","user="******"nopsyco","nowxversion"])
    except getopt.GetoptError:
        # print help information and exit:
        usage()
        sys.exit(2)

    # default values
    output = None
    quote = None
    file = None
    wx = True
    nopsyco = False
    nowxversion = False

    vticker = None
    vquote  = None

    lang = gMessage.getAutoDetectedLang('us')
    for o, a in opts:

        if o == "-d":
            itrade_config.setDisconnected(True)

        if o == "-v" or o == "--verbose":
            itrade_config.verbose = True
            print 'Verbose mode : ON'

        if o == "-x":
            itrade_config.experimental = True

        if o == "-e":
            itrade_portfolio.cmdline_evaluatePortfolio()
            wx = False

        if o == "-i":
            if quote:
                if file:
                    itrade_import.cmdline_importQuoteFromFile(quote,file)
                else:
                    itrade_import.cmdline_importQuoteFromInternet(quote)
            else:
                matrix = itrade_matrix.createMatrix()
                if file:
                    itrade_import.cmdline_importMatrixFromFile(matrix,file)
                else:
                    itrade_import.cmdline_importMatrixFromInternet(matrix)
            wx = False

        if o == "-h" or o == "--help":
            usage()
            sys.exit()

        if o == "-o" or o == "--output":
            output = a

        if o == "-u" or o == "--user":
            itrade_config.dirUserData = a
            if not os.path.exists(itrade_config.dirUserData):
                print 'userdata folder %s not found !' % a
                sys.exit()

        if o  == "--nopsyco":
            nopsyco = True

        if o  == "--nowxversion":
            itrade_config.nowxversion = True

        if o == "-f" or o == "--file":
            file = a

        if o == "-l" or o == "--lang":
            lang = a
            itrade_config.lang = 255

        if o == "-t" or o == "--ticker":
            vticker = a

        if o == "-q" or o == "--quote":
            vquote = a

    # Import Psyco if available
    if not nopsyco:
        try:
            import psyco
            psyco.full()
            print 'Psyco is running'
        except ImportError:
            print 'Psyco is not running (library not found)'
    else:
        print 'Psyco is not running (forced by command line)'

    # load configuration
    itrade_config.loadConfig("itrade.py")
    if itrade_config.verbose:
        print "*** Proxy server:",itrade_config.proxyHostname, "- Proxy auth:",itrade_config.proxyAuthentication,"- Connection timeout:",itrade_config.connectionTimeout

    # load extensions
    itrade_ext.loadExtensions(itrade_config.fileExtData,itrade_config.dirExtData)

    # init modules
    itrade_quotes.initQuotesModule()
    itrade_portfolio.initPortfolioModule()

    # use the correct pack language
    if itrade_config.lang == 255:
        gMessage.setLang(lang)
        gMessage.load()

    # commands
    if vticker:
        quote = itrade_quotes.quotes.lookupTicker(vticker)
        if not quote:
            print 'ticker %s not found !' % vticker
            sys.exit()

    if vquote:
        quote = itrade_quotes.quotes.lookupKey(vquote)
        if not quote:
            print 'quote %s not found ! format is : <ISINorTICKER>.<EXCHANGE>.<PLACE>' % vquote
            sys.exit()

    if wx:
        import itrade_wxmain
        itrade_wxmain.start_iTradeWindow()

    if quote:
        portfolio = itrade_portfolio.loadPortfolio()
        quote.update()
        quote.compute()
        quote.printInfo()