Beispiel #1
0
def get_administrative_messages(seconds: int):
    """Run and AdminConn and print connection stats to screen."""

    admin_conn = iq.AdminConn(name="pyiqfeed-Example-admin-messages")
    admin_listener = iq.VerboseAdminListener("Admin Listener")
    admin_conn.add_listener(admin_listener)

    with iq.ConnConnector([admin_conn]) as connector:
        admin_conn.set_admin_variables(product=dtn_product_id,
                                       login=dtn_login,
                                       password=dtn_password,
                                       autoconnect=True)
        admin_conn.client_stats_on()
        time.sleep(seconds)
Beispiel #2
0
                        dest='headless', default=False,
                        help="Launch IQFeed in a headless XServer.")
    parser.add_argument('--control_file', action='store',
                        dest='ctrl_file', default="/tmp/stop_iqfeed.ctrl",
                        help='Stop running if this file exists.')
    arguments = parser.parse_args()

    IQ_FEED = iq.FeedService(product=dtn_product_id,
                             version="IQFEED_LAUNCHER",
                             login=dtn_login,
                             password=dtn_password)

    nohup = arguments.nohup
    headless = arguments.headless
    ctrl_file = arguments.ctrl_file
    IQ_FEED.launch(timeout=30,
                   check_conn=True,
                   headless=headless,
                   nohup=nohup)

    # Modify code below to connect to the socket etc as described above
    admin = iq.AdminConn(name="Launcher")
    admin_listener = iq.VerboseAdminListener("Launcher-listen")
    admin.add_listener(admin_listener)
    with iq.ConnConnector([admin]) as connected:
        admin.client_stats_on()
        while not os.path.isfile(ctrl_file):
            time.sleep(10)

    os.remove(ctrl_file)