Code Monkey home page Code Monkey logo

ib's People

Contributors

anthonyng2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ib's Issues

How to move historical data to main()

Great code examples. I wrote a simple code based on your examples. It prints data under historicalData but not in the main() function. How do I create a dataframe in main() with historical data? For some reason it doesnt work below.

Thanks!

from ibapi.client import EClient
from ibapi.wrapper import EWrapper
from ibapi.common import *
from ibapi.contract import *
from ibapi.ticktype import TickTypeEnum
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import queue

class TestWrapper(EWrapper,EClient):
def initiate_variables(self):
setattr(self, 'historical_Data', [])
setattr(self, 'historical_DataEnd_flag', False)

def historicalData(self, reqId, bar):
historical_Data = self.historical_Data
historical_Data.append((reqId, bar.date, bar.open, bar.high, bar.low, bar.close, bar.volume))
print("data", reqId, bar.date, bar.open, bar.high, bar.low, bar.close, bar.volume)

def main():

callback = TestWrapper() # Instantiate IBWrapper. callback
tws = EClient(callback) # Instantiate EClientSocket and return data to callback

tws.connect(host='127.0.0.1', port=4002, clientId=5)

callback.initiate_variables()
contract = Contract()
contract.symbol = "EUR"
contract.secType = "CASH"
contract.currency = "USD"
contract.exchange = "IDEALPRO"

tws.reqHistoricalData(1101, contract, "", "6000", "1 min", "MIDPOINT", 0, 1, False, [])
data= pd.DataFrame(callback.historical_Data,
columns = ["reqId", "date", "open",
"high", "low", "close",
"volume"])
data[-10:]
tws.run()
print(data)
tws.disconnect()

if __name__ == '__main__':
main()

Unable to get working in IPynb

Hello,

I purchased your udemy course, and greatly enjoyed it -- however upon going to your github I'm unable to get the software to work in Ipynb -- I can get the imports to work, however can't create instances of EWrapper/IBWrapper. Even made a class and extended functionality of IBWrapper/EClient -- still no luck.

Please advise -- and yes the software/twsapi is downloaded, basic tws calls work (requesting data) in pycharm just not able to get your code working in ipynb.

Any help would be greatly appreciated.

Here's the error thrown.

TypeError: Can't instantiate abstract class EWrapper with abstract methods accountDownloadEnd, accountSummary, accountSummaryEnd, bondContractDetails, commissionReport, connectionClosed, contractDetails, contractDetailsEnd, currentTime, deltaNeutralValidation, error, error_0, error_1, execDetails, execDetailsEnd, fundamentalData, historicalData, managedAccounts, marketDataType, nextValidId, openOrder, openOrderEnd, orderStatus, position, positionEnd, realtimeBar, receiveFA, scannerData, scannerDataEnd, scannerParameters, tickEFP, tickGeneric, tickOptionComputation, tickPrice, tickSize, tickSnapshotEnd, tickString, updateAccountTime, updateAccountValue, updateMktDepth, updateMktDepthL2, updateNewsBulletin, updatePortfolio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.