Coder Social home page Coder Social logo

pocketoptionapi's Issues

Buy Sample is not work!

Hello. I'm trying to check example on guidance, but it is not work!
I changed line check_connect,message=account.connect() on account.connect() and if check_connect: on if account.check_connect: but it is not get resault.

ssid=r"""42["auth",{"session":"a:4:{s:10:\"session_id\";s:32:\"123123123123\";s:10:\"ip_address\";s:12:\"2.111.11.5\";s:10:\"user_agent\";s:104:\"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36\";s:13:\"last_activity\";i:123232;}1232321213","isDemo":0,"uid":"123232132"}]"""
account=PocketOption(ssid)
check_connect,message=account.connect()
if check_connect:
    account.change_balance("PRACTICE")#"REAL"
    asset="EURUSD"
    amount=1
    dir="call"#"call"/"put"
    duration=30#sec
    print("Balance: ",account.get_balance())
    buy_info=account.buy(asset,amount,dir,duration)
    #need this to close the connect
    print("----Trade----")
    print("Get: ",account.check_win(buy_info["id"]))
    print("----Trade----")
    print("Balance: ",account.get_balance())
    #need close ping server thread
    account.close()```

response 41 after sending 42 auth session

Hello! I'm doing web socket reverse engineering too, ran into a problem, I'm doing the same as you:

  1. I connect to the web socket
  2. I get "0 sid..."
  3. Send "40" in response
  4. Receive message "40 sid..."
  5. I reply with "42 auth session"
  6. I get "41" in reply
async def process_message(message, websocket):
    print(message)
    if message.startswith('0{"sid":"'):
        message = message.lstrip("0")
        data = json.loads(message)
        print("got 0 sid send 40 ")
        await websocket.send("40")
    elif message == "2":
        print("got 2 send 3")
        await websocket.send("3")
    elif message.startswith('40{"sid":"'):
        print("got 40 sid send session")
        data = r"""42["auth",{"session":"a:4:{s:10:"session_id";s:32:"c53eec05c6f8a8be2d134d4fd55266f8";s:10:"ip_address";s:14:"46.138.176.190";s:10:"user_agent";s:101:"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36";s:13:"last_activity";i:1707850603;}9f383935faff5a86bc1658bbde8c61e7","isDemo":1,"uid":72038016,"platform":3}]"""
        await websocket.send(data)

I don't understand what this is about, could you please advise me?
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.