예제 #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)
예제 #2
0
                        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 = CustomFeedService(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=60,
                   check_conn=True,
                   headless=headless,
                   nohup=nohup)

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

    os.remove(ctrl_file)