Skip to content

Commit

Permalink
Merge pull request #16 from TheSunsetCode/main
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
theshadow76 authored Jun 21, 2024
2 parents fbe8616 + 7fad350 commit dc8cba3
Show file tree
Hide file tree
Showing 97 changed files with 601 additions and 2,378 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# talk with us
https://discord.gg/du4GaQGHMT



# Pocket Option API

In development!

for a better understanding, check this [link](https://github.com/theshadow76/PocketOptionAPI/issues/4)

there is a pocketoption api being sold for 1000 usd, and here we want to make it for free!
# help me

you can donate here: [paypal](https://paypal.me/shadowtechsc?country.x=CL&locale.x=es_XC)

or my BTC adress: bc1qmvpmpdt96vmgq3s3rh3gzxf75eml52r2d7sclw

By donating you are helping me make this project better!
4 changes: 3 additions & 1 deletion docs/todo.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# todo

### Add login system
- Not Done
- Not Done

-- updated
Binary file modified pocketoptionapi/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file modified pocketoptionapi/__pycache__/api.cpython-310.pyc
Binary file not shown.
Binary file removed pocketoptionapi/__pycache__/api.cpython-311.pyc
Binary file not shown.
Binary file added pocketoptionapi/__pycache__/api.cpython-39.pyc
Binary file not shown.
Binary file modified pocketoptionapi/__pycache__/constants.cpython-310.pyc
Binary file not shown.
Binary file modified pocketoptionapi/__pycache__/constants.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file modified pocketoptionapi/__pycache__/expiration.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified pocketoptionapi/__pycache__/global_value.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified pocketoptionapi/__pycache__/stable_api.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
118 changes: 71 additions & 47 deletions pocketoptionapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,50 @@
import atexit
from collections import deque
from pocketoptionapi.ws.client import WebsocketClient
from pocketoptionapi.ws.chanels.get_balances import *

from pocketoptionapi.ws.chanels.ssid import Ssid
# from pocketoptionapi.ws.chanels.subscribe import *
# from pocketoptionapi.ws.chanels.unsubscribe import *
# from pocketoptionapi.ws.chanels.setactives import SetActives
from pocketoptionapi.ws.chanels.candles import GetCandles
# from pocketoptionapi.ws.chanels.buyv2 import Buyv2
from pocketoptionapi.ws.chanels.buyv3 import *
# from pocketoptionapi.ws.chanels.user import *
# from pocketoptionapi.ws.chanels.api_game_betinfo import Game_betinfo
# from pocketoptionapi.ws.chanels.instruments import Get_instruments
# from pocketoptionapi.ws.chanels.get_financial_information import GetFinancialInformation
# from pocketoptionapi.ws.chanels.strike_list import Strike_list
# from pocketoptionapi.ws.chanels.leaderboard import Leader_Board

# from pocketoptionapi.ws.chanels.traders_mood import Traders_mood_subscribe
# from pocketoptionapi.ws.chanels.traders_mood import Traders_mood_unsubscribe
# from pocketoptionapi.ws.chanels.buy_place_order_temp import Buy_place_order_temp
# from pocketoptionapi.ws.chanels.get_order import Get_order
# from pocketoptionapi.ws.chanels.get_deferred_orders import GetDeferredOrders
# from pocketoptionapi.ws.chanels.get_positions import *

# from pocketoptionapi.ws.chanels.get_available_leverages import Get_available_leverages
# from pocketoptionapi.ws.chanels.cancel_order import Cancel_order
# from pocketoptionapi.ws.chanels.close_position import Close_position
# from pocketoptionapi.ws.chanels.get_overnight_fee import Get_overnight_fee
# from pocketoptionapi.ws.chanels.heartbeat import Heartbeat

# from pocketoptionapi.ws.chanels.digital_option import *
# from pocketoptionapi.ws.chanels.api_game_getoptions import *
# from pocketoptionapi.ws.chanels.sell_option import Sell_Option
# from pocketoptionapi.ws.chanels.change_tpsl import Change_Tpsl
# from pocketoptionapi.ws.chanels.change_auto_margin_call import ChangeAutoMarginCall
from pocketoptionapi.ws.channels.get_balances import *

from pocketoptionapi.ws.channels.ssid import Ssid
# from pocketoptionapi.ws.channels.subscribe import *
# from pocketoptionapi.ws.channels.unsubscribe import *
# from pocketoptionapi.ws.channels.setactives import SetActives
from pocketoptionapi.ws.channels.candles import GetCandles
# from pocketoptionapi.ws.channels.buyv2 import Buyv2
from pocketoptionapi.ws.channels.buyv3 import *
# from pocketoptionapi.ws.channels.user import *
# from pocketoptionapi.ws.channels.api_game_betinfo import Game_betinfo
# from pocketoptionapi.ws.channels.instruments import Get_instruments
# from pocketoptionapi.ws.channels.get_financial_information import GetFinancialInformation
# from pocketoptionapi.ws.channels.strike_list import Strike_list
# from pocketoptionapi.ws.channels.leaderboard import Leader_Board

# from pocketoptionapi.ws.channels.traders_mood import Traders_mood_subscribe
# from pocketoptionapi.ws.channels.traders_mood import Traders_mood_unsubscribe
# from pocketoptionapi.ws.channels.buy_place_order_temp import Buy_place_order_temp
# from pocketoptionapi.ws.channels.get_order import Get_order
# from pocketoptionapi.ws.channels.get_deferred_orders import GetDeferredOrders
# from pocketoptionapi.ws.channels.get_positions import *

# from pocketoptionapi.ws.channels.get_available_leverages import Get_available_leverages
# from pocketoptionapi.ws.channels.cancel_order import Cancel_order
# from pocketoptionapi.ws.channels.close_position import Close_position
# from pocketoptionapi.ws.channels.get_overnight_fee import Get_overnight_fee
# from pocketoptionapi.ws.channels.heartbeat import Heartbeat

# from pocketoptionapi.ws.channels.digital_option import *
# from pocketoptionapi.ws.channels.api_game_getoptions import *
# from pocketoptionapi.ws.channels.sell_option import Sell_Option
# from pocketoptionapi.ws.channels.change_tpsl import Change_Tpsl
# from pocketoptionapi.ws.channels.change_auto_margin_call import ChangeAutoMarginCall

from pocketoptionapi.ws.objects.timesync import TimeSync
# from pocketoptionapi.ws.objects.profile import Profile
from pocketoptionapi.ws.objects.candles import Candles
# from pocketoptionapi.ws.objects.listinfodata import ListInfoData
# from pocketoptionapi.ws.objects.betinfo import Game_betinfo_data
import pocketoptionapi.global_value as global_value
from pocketoptionapi.ws.channels.change_symbol import ChangeSymbol
from collections import defaultdict
from pocketoptionapi.ws.objects.time_sync import TimeSynchronizer


def nested_dict(n, type):
Expand All @@ -71,7 +73,10 @@ class PocketOptionAPI(object): # pylint: disable=too-many-instance-attributes

# pylint: disable=too-many-public-methods
socket_option_opened = {}
timesync = TimeSync()
time_sync = TimeSync()
sync = TimeSynchronizer()
timesync = None
# pylint: disable=too-many-arguments
# profile = Profile()
candles = Candles()
# listinfodata = ListInfoData()
Expand Down Expand Up @@ -132,6 +137,8 @@ class PocketOptionAPI(object): # pylint: disable=too-many-instance-attributes
users_availability = None
history_data = None
historyNew = None
server_timestamp = None
sync_datetime = None

# ------------------

Expand Down Expand Up @@ -177,11 +184,9 @@ def send_websocket_request(self, name, msg, request_id="", no_force_send=True):
data = f'42{json.dumps(msg)}'

while (global_value.ssl_Mutual_exclusion or global_value.ssl_Mutual_exclusion_write) and no_force_send:

pass
global_value.ssl_Mutual_exclusion_write = True

# self.websocket_client.send_message(data)
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)

Expand Down Expand Up @@ -223,27 +228,22 @@ def connect(self):
global_value.ssl_Mutual_exclusion = False
global_value.ssl_Mutual_exclusion_write = False

try:
self.close()
except:
pass

check_websocket, websocket_reason = self.start_websocket()

if not check_websocket:
return check_websocket, websocket_reason

self.timesync.server_timestamps = None
self.time_sync.server_timestamps = None
while True:
try:
if self.timesync.server_timestamps is not None:
if self.time_sync.server_timestamps is not None:
break
except:
pass
return True, None

def close(self):
self.websocket.close()
async def close(self, error=None):
await self.websocket.on_close(error)
self.websocket_thread.join()

def websocket_alive(self):
Expand All @@ -269,6 +269,30 @@ def getcandles(self):
"""Property for get IQ Option websocket candles chanel.
:returns: The instance of :class:`GetCandles
<iqoptionapi.ws.chanels.candles.GetCandles>`.
<pocketoptionapi.ws.channels.candles.GetCandles>`.
"""
return GetCandles(self)

@property
def change_symbol(self):
"""Property for get Pocket Option websocket change_symbol chanel.
:returns: The instance of :class:`ChangeSymbol
<iqoptionapi.ws.channels.change_symbol.ChangeSymbol>`.
"""
return ChangeSymbol(self)

@property
def synced_datetime(self):
try:
if self.time_sync is not None:
self.sync.synchronize(self.time_sync.server_timestamp)
self.sync_datetime = self.sync.get_synced_datetime()
else:
logging.error("timesync no está establecido")
self.sync_datetime = None
except Exception as e:
logging.error(e)
self.sync_datetime = None

return self.sync_datetime
36 changes: 19 additions & 17 deletions pocketoptionapi/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,23 +137,25 @@

class REGION:
REGIONS = {
"EUROPA": "wss://api-eu.po.market/socket.io/?EIO=4&transport=websocket",
"SEYCHELLES": "wss://api-sc.po.market/socket.io/?EIO=4&transport=websocket",
"HONGKONG": "wss://api-hk.po.market/socket.io/?EIO=4&transport=websocket",
"SERVER1": "wss://api-spb.po.market/socket.io/?EIO=4&transport=websocket",
"FRANCE2": "wss://api-fr2.po.market/socket.io/?EIO=4&transport=websocket",
"UNITED_STATES4": "wss://api-us4.po.market/socket.io/?EIO=4&transport=websocket",
"UNITED_STATES3": "wss://api-us3.po.market/socket.io/?EIO=4&transport=websocket",
"UNITED_STATES2": "wss://api-us2.po.market/socket.io/?EIO=4&transport=websocket",
"UNITED_STATES": "wss://api-us-north.po.market/socket.io/?EIO=4&transport=websocket",
"RUSSIA": "wss://api-msk.po.market/socket.io/?EIO=4&transport=websocket",
"SERVER2": "wss://api-l.po.market/socket.io/?EIO=4&transport=websocket",
"INDIA": "wss://api-in.po.market/socket.io/?EIO=4&transport=websocket",
"FRANCE": "wss://api-fr.po.market/socket.io/?EIO=4&transport=websocket",
"FINLAND": "wss://api-fin.po.market/socket.io/?EIO=4&transport=websocket",
"SERVER3": "wss://api-c.po.market/socket.io/?EIO=4&transport=websocket",
"ASIA": "wss://api-asia.po.market/socket.io/?EIO=4&transport=websocket",
"SERVER4": "wss://api-us-south.po.market/socket.io/?EIO=4&transport=websocket"
# "EUROPA": "wss://api-eu.po.market/socket.io/?EIO=4&transport=websocket",
# "SEYCHELLES": "wss://api-sc.po.market/socket.io/?EIO=4&transport=websocket",
# "HONGKONG": "wss://api-hk.po.market/socket.io/?EIO=4&transport=websocket",
# "SERVER1": "wss://api-spb.po.market/socket.io/?EIO=4&transport=websocket",
# "FRANCE2": "wss://api-fr2.po.market/socket.io/?EIO=4&transport=websocket",
# "UNITED_STATES4": "wss://api-us4.po.market/socket.io/?EIO=4&transport=websocket",
# "UNITED_STATES3": "wss://api-us3.po.market/socket.io/?EIO=4&transport=websocket",
# "UNITED_STATES2": "wss://api-us2.po.market/socket.io/?EIO=4&transport=websocket",
"DEMO": "wss://demo-api-eu.po.market/socket.io/?EIO=4&transport=websocket",
# "DEMO_2": "wss://try-demo-eu.po.market/socket.io/?EIO=4&transport=websocket",
# "UNITED_STATES": "wss://api-us-north.po.market/socket.io/?EIO=4&transport=websocket",
# "RUSSIA": "wss://api-msk.po.market/socket.io/?EIO=4&transport=websocket",
# "SERVER2": "wss://api-l.po.market/socket.io/?EIO=4&transport=websocket",
# "INDIA": "wss://api-in.po.market/socket.io/?EIO=4&transport=websocket",
# "FRANCE": "wss://api-fr.po.market/socket.io/?EIO=4&transport=websocket",
# "FINLAND": "wss://api-fin.po.market/socket.io/?EIO=4&transport=websocket",
# "SERVER3": "wss://api-c.po.market/socket.io/?EIO=4&transport=websocket",
# "ASIA": "wss://api-asia.po.market/socket.io/?EIO=4&transport=websocket",
# "SERVER4": "wss://api-us-south.po.market/socket.io/?EIO=4&transport=websocket"
}

def __getattr__(self, key):
Expand Down
9 changes: 9 additions & 0 deletions pocketoptionapi/prueba_temp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pandas as pd


df_1 = pd.read_csv('datos_completos_AUDNZD_otc.csv')
df_2 = pd.read_csv('datos_completos_AUDNZD_otc_2.csv')

df_full = pd.concat([df_1, df_2], axis=0)
print(df_full.shape)
df_full.to_csv('datos_full_AUDNZD_otc.csv', index=False)
Loading

0 comments on commit dc8cba3

Please sign in to comment.