Closed fabrimob closed 2 years ago
Merhaba,
stamp = int(time.time())*1000
data = "{}{}".format(self.public_key, stamp).encode('utf-8')
private_key = base64.b64decode(self.private_key)
signature = hmac.new(private_key, data, hashlib.sha256).digest()
headers= {
"X-PCK": self.public_key,
"X-Stamp": str(stamp),
"X-Signature": str(base64.b64encode(signature).decode('utf-8'))
}
kodu ile deneyebilir misiniz?
Ayrıca API anahtarınızı https://pro.btcturk.com/hesap-ayarlari/api adresinden aldığınızdan emin olun. Btcturk.com'dan alınan API anahtarları V1 ile uyumlu değildir.
Merhaba, python istemcilerinin erişim yetkileri ile ilgili bir güncelleme yayınlandı. Tekrar deneyebilir misiniz?
Selamlar, deneye yanila cozdum. Dokumanlarda belirtilmemis post datasinin nasil gonderilecegi. Eski api dokumaninizda acikca yazmistiniz application/x-www-form-urlencoded diye. Yenisine de eklerseniz guzel olur.
application/x-www-form-urlencoded yerine application/json olmali headerlarda ve buna bagli olarak
response = requests.post(BtcTurk.__api["order"], data=params, headers=auth.get('headers'), verify=True)
degil,
response = requests.post(BtcTurk.__api["order"], json=params, headers=auth.get('headers'), verify=True)
olmali
Merhaba, API dokümanlarımızı güncelliyoruz. Yeni dokümanlarda örnekler ve sonuçlar daha detaylı anlatılacak. Bilgilendirme için teşekkür ederiz.
"Ayrıca API anahtarınızı https://pro.btcturk.com/hesap-ayarlari/api adresinden aldığınızdan emin olun. Btcturk.com'dan alınan API anahtarları V1 ile uyumlu değildir."
Merhaba Bence Bunu ana sayfadaki dökümantasyona koymalısınız, Bende burda takıldım 2 saat sonra bu ibareyi görünce problem çözüldü,
url="https://api.btcturk.com/api/v1/order"
public_key='hidden'
private_key='hidden'
private_key = base64.b64decode(private_key)
stamp = str(int(time.time())*1000)
data = "{}{}".format(public_key, stamp).encode('utf-8')
signature = hmac.new(private_key, data, hashlib.sha256).digest()
signature = base64.b64encode(signature)
headers={"X-PCK": public_key,"X-Stamp": stamp,"X-Signature": signature}
params={"quantity": 0.1,"price": 0,"stopPrice": 0, "newOrderClientId":"", "orderMethod":"market", "orderType":"sell", "pairSymbol":"ETHUSDT"}
data={}
resp = requests.post(url=url, headers=headers, params=params, data=data)
print resp
İyi günler, 0.1 ETH/USDT satış emri verebilmek için Python'da yukarıdaki şekilde kodu oluşturdum. Kodu çalıştırdığımda Server dan sürekli 415 hatası dönüyor. Nerede hata yaptığımı bir türlü bulamadım. Python'da api üzerinden al / sat emri açabilmem konusunda yardımcı olabilir misiniz? Saygılarımla,
Not: url="https://api.btcturk.com/api/v1/users/balances" adresinden, resp = requests.get(url=url, headers=headers, params=params, data=data) komutu ile Balance bilgilerini başarılı şekilde alabiliyorum. Dolayısıyla headers ların oluşturulmasında bir sıkıntı olmadığını düşünüyorum.
Merhaba,
fetch_balance i basarili sekilde yapiyorum , ancak buy sell islemlerinde hata donuyor. Dolayisiyla authenticationda bir sikinti oldugunu dusunmuyorum.
https://api.btcturk.com/api/v1/order endpointi, 415 Unsupported Media Type donuyor surekli , body yi encode edip-etmeyip her turlu denedim, header 'Content-Type' i denedim(application/x-www-form-urlencoded, application/json) sonuc basarisiz.
Ayrintilari asagida da gorebilirsiniz:
headerlar: {'User-Agent': 'Mozilla/5.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '/', 'Connection': 'keep-alive', 'Content-Type': 'application/x-www-form-urlencoded', 'X-PCK': 'hidden', 'X-Stamp': '1869351613821', 'X-Signature': 'hidden', 'Content-Length': '118'}
body: '{"quantity": 0.00087, "price": 0, "stopPrice": 0, "orderMethod": "market", "orderType": "buy", "pairSymbol": "BTCTRY"}'
url: 'https://api.btcturk.com/api/v1/order'
Yardiminizi rica ediyorum