question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to fetch news

See original GitHub issue

Problem: I am not able to fetch news in a Jupyter notebook, e.g. from Briefing.com

import datetime
from ib_insync import *

util.startLoop()
ib = IB()
ib.connect('127.0.0.1', 4001, clientId=1)
# connected

br=Contract(symbol="BRFG:BRFG_ALL", exchange="NEWS",conId="100283238")
cd=ib.reqContractDetails(br)
md=ib.reqMktData(br,"292")

The IBKR Gateway answers:

2020-05-01 08:54:48.053 [TN] INFO  [JTS-Cleaner-31] - market data wrapper, cleaning maps
2020-05-01 08:54:59.676 [TN] INFO  [JTS-CCPDispatcherS2-33] - Setting time offset to -4676 diff -278
2020-05-01 08:54:59.676 [TN] INFO  [JTS-CCPDispatcherS2-33] - CCP reported time: 2020-05-01 06:54:55.000 (GMT) [1588316095000], local time: 2020-05-01 06:54:59.676 (GMT), local time: 2020-05-01 08:54:59.676 (CEST), difference in seconds: -4.676, handling delta:n/a [Msg1]
2020-05-01 08:55:01.457 [TN] INFO  [JTS-CCPDispatcherS2-33] - [1:152:152:1:0:0:0:ERR] Can't write, socket client{1} is closing.
2020-05-01 08:55:01.472 [TN] INFO  [JTS-CCPDispatcherS2-33] - [1:152:152:1:0:0:0:ERR] Can't write, socket client{1} is closing.
2020-05-01 08:55:01.472 [TN] INFO  [JTS-CCPDispatcherS2-33] - [1:152:152:1:0:0:0:ERR] Can't write, socket client{1} is closing.
2020-05-01 08:55:01.519 [TN] INFO  [JTS-CCPDispatcherS2-33] - The EBuffer buffer has grown to 14745 bytes
2020-05-01 08:55:01.519 [TN] INFO  [JTS-CCPDispatcherS2-33] - [1:152:152:1:0:0:0:ERR] Can't write, socket client{1} is closing.
2020-05-01 08:55:01.535 [TN] INFO  [JTS-CCPDispatcherS2-33] - [1:152:152:1:0:0:0:ERR] Can't write, socket client{1} is closing.
2020-05-01 08:55:01.551 [TN] INFO  [JTS-CCPDispatcherS2-33] - The EBuffer buffer has grown to 17694 bytes
2020-05-01 08:55:01.551 [TN] INFO  [JTS-CCPDispatcherS2-33] - [1:152:152:1:0:0:0:ERR] Can't write, socket client{1} is closing.
2020-05-01 08:55:01.566 [TN] INFO  [JTS-CCPDispatcherS2-33] - The EBuffer buffer has grown to 21232 bytes
2020-05-01 08:55:01.597 [TN] INFO  [JTS-CCPDispatcherS2-33] - LOG Client 1 Output exceeded limit (was: 100047), removed first half
2020-05-01 08:55:39.775 [TN] INFO  [JTS-CCPDispatcherS2-33] - Setting time offset to -4775 diff -99

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
erdewitcommented, Jun 27, 2020

ValueError: time data ‘2020-06-16 12:00:28.0’ does not match format ‘%Y%m%d %H:%M:%S’

Thank you for the report. It seems that IB has decided to use a different format for the datetime.

The util.parseIBDatetime function has been updated to account for this.

0reactions
captainswingadcommented, Jun 26, 2020

PROBLEM : time format is not matching when i am calling reqHistoricalNews import pandas as pd import asyncio from ib_insync import * import numpy as np import nest_asyncio import datetime nest_asyncio.apply() ib = IB() ib.connect(‘127.0.0.1’, 7497, clientId=17) ​ ​ ​ x = datetime.datetime(2020, 6, 20) y = datetime.datetime(2020, 6, 27) print(x,y) ​ ​ newsProviders = ib.reqNewsProviders() print(newsProviders) codes = ‘+’.join(np.code for np in newsProviders) print(codes) amd = Stock(‘AMD’, ‘SMART’, ‘USD’) ib.qualifyContracts(amd) print(amd) headlines = ib.reqHistoricalNews(amd.conId, codes ,x,y, 10) print(headlines) latest = headlines[0] print(latest) article = ib.reqNewsArticle(latest.providerCode, latest.articleId) print(article)

ERROR

File “/home/am/.local/lib/python3.6/site-packages/ib_insync/decoder.py”, line 178, in handler method(*args) File “/home/am/.local/lib/python3.6/site-packages/ib_insync/wrapper.py”, line 973, in historicalNews dt = parseIBDatetime(time) File “/home/am/.local/lib/python3.6/site-packages/ib_insync/util.py”, line 529, in parseIBDatetime dt = datetime.strptime(s, ‘%Y%m%d %H:%M:%S’) File “/usr/lib/python3.6/_strptime.py”, line 565, in _strptime_datetime tt, fraction = _strptime(data_string, format) File “/usr/lib/python3.6/_strptime.py”, line 362, in _strptime (data_string, format)) ValueError: time data ‘2020-06-16 12:00:28.0’ does not match format ‘%Y%m%d %H:%M:%S’

Read more comments on GitHub >

github_iconTop Results From Across the Web

Altstore says (Unable to fetch news) and (could not refresh ...
Altstore says (Unable to fetch news) and (could not refresh store) when I open the app. Anyone have any ideas? It was working...
Read more >
Matray gives error trying to fetch news - Manjaro Linux Forum
I'm getting pop ups at the news icon thing in the Systray… Error Occurred Fetching news. Could not connect: Network is unreachable.
Read more >
Unable to fetch a list of sections #609 - GitHub
There “Unable to fetch a list of sections“. Same error when I open “Apple News > Sections”.
Read more >
Axios unable to fetch API data after deploying the React App ...
I am making an web app to get latest news updates andI am having problem after deploying it. The app is ...
Read more >
iOS 16 Fix Apple iPhone News App not Working, Loading (2022)
Unable to Fetch new Updates in News App. News App has millions of Webpage that Apple officially crawls. Apple News and News+ Both...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found