Bitcoin Forum
May 11, 2024, 10:58:53 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: topboy: 是否有打算开始提供交易API?  (Read 783 times)
zhangweiwu (OP)
Sr. Member
****
Offline Offline

Activity: 313
Merit: 250


View Profile
October 29, 2013, 12:03:43 PM
 #1

既然btctrade老板在这里,就直接问了。交易API目前在你的待办事宜里优先级高吗?

My (old) column about Bitcoin & China: http://bitcoinblog.de/tag/zhangweiwuengl/
1715425133
Hero Member
*
Offline Offline

Posts: 1715425133

View Profile Personal Message (Offline)

Ignore
1715425133
Reply with quote  #2

1715425133
Report to moderator
1715425133
Hero Member
*
Offline Offline

Posts: 1715425133

View Profile Personal Message (Offline)

Ignore
1715425133
Reply with quote  #2

1715425133
Report to moderator
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, which will follow the rules of the network no matter what miners do. Even if every miner decided to create 1000 bitcoins per block, full nodes would stick to the rules and reject those blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715425133
Hero Member
*
Offline Offline

Posts: 1715425133

View Profile Personal Message (Offline)

Ignore
1715425133
Reply with quote  #2

1715425133
Report to moderator
1715425133
Hero Member
*
Offline Offline

Posts: 1715425133

View Profile Personal Message (Offline)

Ignore
1715425133
Reply with quote  #2

1715425133
Report to moderator
topboy
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
October 30, 2013, 03:46:27 AM
 #2

交易API我们已经开发完成了,目前正在内测,您希望使用API来做什么呢,也可以联系我们来参加内测~
evozone
Full Member
***
Offline Offline

Activity: 127
Merit: 100


View Profile
October 30, 2013, 07:12:36 AM
 #3

我申请参加内测。。。

BTC:1NHTXFpdD3wqPfiN9RybZmVV8jBnUzcTJ2                 LTC:LWLemXF61Z5X3Nb2ZSPFgQgrfUfoeqgSYB
oldfox126
Full Member
***
Offline Offline

Activity: 127
Merit: 100


View Profile WWW
October 30, 2013, 07:57:48 AM
 #4

已经做好了?速度很快呀

zhangweiwu (OP)
Sr. Member
****
Offline Offline

Activity: 313
Merit: 250


View Profile
October 30, 2013, 04:03:12 PM
Last edit: October 30, 2013, 04:17:32 PM by zhangweiwu
 #5

交易API我们已经开发完成了,目前正在内测,您希望使用API来做什么呢,也可以联系我们来参加内测~

我想用API做两件事,一是快速止损,即发现跌速达到每分钟5元时,立即用market order止损。二是投机,即发现跌速达到每分钟5元时,如果这种情况持续十几分钟,用market order低点买进。

我做这两件事为的是,我预计到不明真相的人民群众太多,参与者没投资经验,总是会对价格趋势过度反应,往往一小时才会回调,所以可以利用过度反应投机。当然这样做是有风险的,遇到真的坏新闻,坏到广大群众应该过度反应的程度,那么我就玩火自焚了,但是小赌怡情嘛。要做这种事肯定不能天天守着,要写dæmon的。你可以许可我参与内测吗?

我考虑过用外国市场,但是觉得还是中国市场守着电脑炒币又喜欢过度反应的用户比较多,针对这些人投机应该在国内做。
我考虑过用BTCChina,但是其API设计得令人吐血,你看一眼我下面的笔记就知道它有多令人吐血了(我编程时用英文思考,所以笔记是英语的,平常我还是用中文思考的)。这个笔记只是在说,发一个合同后,如何检查它是否已经执行(在我的计算中,要用其执行时间,决定是否再发一个更大的合同),没想到检查合同是否执行需要极复杂的逻辑,笔记里有详说。

Code:
How to find if an order is executed, on BTCChina
        1. If an order is a market order, or it can be executed immediately like
        a market order (e.g. buying at a price much beyond the market price), it
        will be executed without producing an item in getOrders list. The order  
        is simply not there, non existance! This can be verified by just go to  
        order management in the browser and verify market orders ain't there.    
        You need to look up transactions to find its trace, but there is no way  
        to look up transactions in BTCChina's API. (Tried "getTransactions" in  
        the hope that it is there undocumented.) In this case, the order maps to
        a single transaction, with an averaged price. I experimented with a      
        market order of as large as 60BTC, and it is marked a single transaction
        . There is no way to find out how the price averaged up.    

        2. If an order can not be executed immediately, it will obtain an
        order ID. This is different from the Transaction ID, because in this
case an order maps to multiple Transactions if needed. I experimented
with a purchase of 53BTC and it is splitted into
multiple transactions.

An order in the order book has an 'amount' and an 'amount_original'. The
latter being the amount of the order, the former means the remain
effective amount to be dealt with, which is the original amount minus
the amount dealt.

So how do you place a limit order and check its result?

1. Obtain a list of all orders (except those dealt like market orders).
2. Place an order.
3. Obtain a new list of all orders, and compare it with the old one.
The newly placed order is often listed a few seconds later, so you have
to try a few times to make sure it is really not there.
4. If the new order is in the new list of orders, find its ID and track
its progress until it either finish or times out.
5. If the new order is not in the new list of orders, keep trying until
it times out, and then assume it is fully dealt like a market order.

There is a risk: if an order is placed, neither listed nor executed for
so long time that the routine times out, then it would be mistakenly
considered as fully dealt. To prevent this:

6. If the new order is not in the new list of orders, and the routine
times out: Update the wallet once to see if the wallet change reflect
the contract being fully dealt. If not, this triggers an alarm and this
market no longer participate trading before human intervention.

But that introduces a new problem: if the wallet is updated 5 minutes
ago, and some others (human using browser for example) deals, before the
routin deals, then it would trigger a false alarm. So far there are no
good ways to deal with this situation. We will have to live with it.


My (old) column about Bitcoin & China: http://bitcoinblog.de/tag/zhangweiwuengl/
bhy
Newbie
*
Offline Offline

Activity: 15
Merit: 0


View Profile
October 30, 2013, 07:35:37 PM
 #6

我更关心的是,你们什么时候能把 https 连接正经做好啊?

呵呵。完全不把安全当一回事的。
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!