DDE (eSignal)

Discussion in 'Python' started by BBands, Nov 30, 2006.

  1. BBands

    BBands Guest

    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
    BBands, Nov 30, 2006
    #1
    1. Advertising

  2. BBands schrieb:
    > 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
    Thomas Heller, Nov 30, 2006
    #2
    1. Advertising

  3. BBands

    BBands Guest

    Thomas Heller wrote:
    > 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
    BBands, Nov 30, 2006
    #3
  4. On 30 Nov 2006 10:56:10 -0800, "BBands" <> declaimed the
    following in comp.lang.python:

    >
    > '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

    HTTP://wlfraed.home.netcom.com/
    (Bestiaria Support Staff: )
    HTTP://www.bestiaria.com/
    Dennis Lee Bieber, Dec 1, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Malcolm

    Calling DDE within a web page

    Daniel Malcolm, Oct 6, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    574
    Lucas Tam
    Dec 1, 2004
  2. SPG

    DDE Server

    SPG, Apr 4, 2005, in forum: Java
    Replies:
    0
    Views:
    758
  3. SPG

    DDE Server interaction

    SPG, Apr 5, 2005, in forum: Java
    Replies:
    0
    Views:
    624
  4. =?ISO-8859-1?Q?Miguel_Hern=E1ndez_Martos?=

    DDE Hotlinks in Python

    =?ISO-8859-1?Q?Miguel_Hern=E1ndez_Martos?=, Aug 25, 2003, in forum: Python
    Replies:
    1
    Views:
    616
    Syver Enstad
    Aug 29, 2003
  5. =?iso-8859-1?q?jonathan=20hunt?=

    DDE Python-C++

    =?iso-8859-1?q?jonathan=20hunt?=, Sep 27, 2003, in forum: Python
    Replies:
    0
    Views:
    424
    =?iso-8859-1?q?jonathan=20hunt?=
    Sep 27, 2003
Loading...

Share This Page