DDE (eSignal)

B

BBands

I have a Python ap that needs current stock prices, which I want to get
from eSignal's DDE server. Following the win32all example:

import win32ui
import dde
server = dde.CreateServer()
server.Create("eSignalDDE")
conversation = dde.CreateConversation(server)
conversation.ConnectTo("WINROS", "Last")
last = conversation.Request("$spx")
print last

Which almost works. The return in PythonWin is the correct price as a
string with some extra chartacters appended.

'1402.670000000000\x00\x12\x00*\x00\x00\x004\xfb\x12\x00\xfd\x1a\xd9w4\xc1\x00'

Any thoughts on this?

TIA,

jab
 
T

Thomas Heller

BBands said:
I have a Python ap that needs current stock prices, which I want to get
from eSignal's DDE server. Following the win32all example:

import win32ui
import dde
server = dde.CreateServer()
server.Create("eSignalDDE")
conversation = dde.CreateConversation(server)
conversation.ConnectTo("WINROS", "Last")
last = conversation.Request("$spx")
print last

Which almost works. The return in PythonWin is the correct price as a
string with some extra chartacters appended.

'1402.670000000000\x00\x12\x00*\x00\x00\x004\xfb\x12\x00\xfd\x1a\xd9w4\xc1\x00'

Any thoughts on this?

TIA,

jab

Looks like a bug, either in the dde module or the dde server.
But it's easy to find a workaround:
'1402.670000000000\x00\x12\x00*\x00\x00\x004\xfb\x12\x00\xfd\x1a\xd9w4\xc1\x00'.split("\0")[0] '1402.670000000000'

Thomas
 
B

BBands

Thomas said:
Looks like a bug, either in the dde module or the dde server.
But it's easy to find a workaround:
'1402.670000000000\x00\x12\x00*\x00\x00\x004\xfb\x12\x00\xfd\x1a\xd9w4\xc1\x00'.split("\0")[0]
'1402.670000000000'

float(last.split("\0")[0]) works for me.

Thanks for that!

jab
 
D

Dennis Lee Bieber

'1402.670000000000\x00\x12\x00*\x00\x00\x004\xfb\x12\x00\xfd\x1a\xd9w4\xc1\x00'
null, <ctrl-r>, null, *, null, null, null, 4, <unknown>, <ctrl-r>,
null, <unknown>, <ctrl-z>, <unknown>, w4, <unknown>, null

Interesting combination... I'm tempted to see if any of that decodes
as Baudot...

Of course, if all you want is the first n-characters, and you want
it as numeric...

float(theString[:n])
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DDE 1
DDE error Poke Failed 0

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top