Giter Club home page Giter Club logo

ib-cp-server's Introduction

ib-cp-server

What is it?

This is a proxy server with POST /v1/api/login API for the Interactive Brokers Client Portal API. Because the official server has no a simple login api, it's hard to run as a headless service.

Ref: Why can't automated login

How it works?

  1. This server offer a POST /v1/api/login api to login to the official server.
  2. When login called, it will open the original login page by chromedp and automated fill the username and password (config by environment variables)
  3. Then IB will send a push to your 2FA device, then you can confirm the login. So you have to enable a Two Factor Authentication (2FA) device. iPhone or Android
  4. After login, you can simple use this server as the official server, because it will proxy all the requests to the official server.

Ref: Official API Endpoints

How to use it?

From source

  1. Install Go
  2. Download clientportal.gw.zip or you can use the one in this repo. I will update it periodically. Unzip it to clientportal.gw folder or somewhere else.
  3. Run go run ./cmd/server or go build ./cmd/server and run ./server

Docker

  1. You can simple pull image by docker pull ppaanngggg/ib-cp-server
  2. Or you can build it by docker build -t ib-cp-server .
  3. Run it by docker run -d --name=ib-cp-server -p 8000:8000 -e IB_USERNAME=your_username -e IB_PASSWORD=your_password ppaanngggg/ib-cp-server

Environment Variables

  1. IB_USERNAME: Your IB Account username
  2. IB_PASSWORD: Your IB Account password
  3. IB_EMBEDDED: If you want main program help you to start the official server, set it to true. Default is ture
  4. IB_EXEC_DIR: if IB_EMBEDDED is true, you can set this to the folder of clientportal.gw folder. Default is ./clientportal.gw
  5. IB_URL: If you start the official server by yourself, you can set this to the url of the official server. Default is https://localhost:5000
  6. SERVER_HOST: The host of this server. Default is 0.0.0.0
  7. SERVER_PORT: The port of this server. Default is 8000
  8. SERVER_TIMEOUT: Request timeout. Default is 60s

ib-cp-server's People

Contributors

ppaanngggg avatar

Watchers

 avatar

Forkers

webclinic017

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.