1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
Return-Path: <andrewlecody@gmail.com>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
[172.17.192.35])
by mail.linuxfoundation.org (Postfix) with ESMTPS id 57A28B44
for <bitcoin-dev@lists.linuxfoundation.org>;
Mon, 13 Mar 2017 18:11:11 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.7.6
Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52])
by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6F86519B
for <bitcoin-dev@lists.linuxfoundation.org>;
Mon, 13 Mar 2017 18:11:10 +0000 (UTC)
Received: by mail-wm0-f52.google.com with SMTP id v186so46922500wmd.0
for <bitcoin-dev@lists.linuxfoundation.org>;
Mon, 13 Mar 2017 11:11:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=0P7pjizw6/Md77UvrR6IgDQKyj5a67zqvH/YH9YAAeE=;
b=cn8WP1jkRLgHdcpQg9Tf3yyAMjPV5MpP7qJB44IbKmsay1a7kHwfDXJiEVJG/Xv16o
S+D0mHw4ATCx5EFME/9TS8PwEdeak1xve6mXOHrIe75MD2qDdEP/2AeljmnywukRFuPT
tRPnTHohZRwkXxXVTrbQV69xTthbmINslxfW0jgX0vdzfHK26EEOwcsWZNCMl8aVLKeD
kbyFlDSJbWPqXRsoLmrdl8ol5jewvqlW4RGjoJ1Qbsix17WiYQBDCqPhouFml47hZ6wa
FJnEJZUzErPyty4tsFBNI3KcyIq5cZjgBEjMnM9BGsiCqreYaQTMUGHUqwXtmHSSM8WM
O5OQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=0P7pjizw6/Md77UvrR6IgDQKyj5a67zqvH/YH9YAAeE=;
b=h7yXoREiuIZPrYg4d424z/GefpHEzZkUNNJ9P4IEJSUr34hHJEOW72/h02YfF3m/xu
8SvYzGGQsTvH228BspNSGx3dnozSx8ZLVXTwws3OAHJpU8gnm5r88TFBPxqplqn+RZif
Cl7KaPH8EVLQziJFSA6QnvZPEDdksKuHfmLgFvIf2zX1cgWYEdzy27gC09dkUGKfrIeL
+n+leR2ei1+PUukbA1vZSZGVRttzEpHNfk42ddsXQv3t13Luvd3e0HCpHYNzgzCl63WV
OfSHOZnulKT1UThsWmJd82x7A3xmiC7RkFCuCh0LT7ku90NcNUtPlLNQyk2vvl4ZdmNi
OM0w==
X-Gm-Message-State: AFeK/H2+EFWaVl7wZPGzrQuoKIp0ANA+ze1MWowdM4K24yzgul833vh/THTd2XQAeGORe0FeMyXebWoPREmMHQ==
X-Received: by 10.28.137.211 with SMTP id l202mr11015172wmd.118.1489428668886;
Mon, 13 Mar 2017 11:11:08 -0700 (PDT)
MIME-Version: 1.0
References: <201703040827.33798.luke@dashjr.org>
<CAAUq487pjZYTZJDNv2TL8Vwh-nGqaFVZLG1v4VUJu=ejcx45nw@mail.gmail.com>
In-Reply-To: <CAAUq487pjZYTZJDNv2TL8Vwh-nGqaFVZLG1v4VUJu=ejcx45nw@mail.gmail.com>
From: Andrew LeCody <andrewlecody@gmail.com>
Date: Mon, 13 Mar 2017 18:10:57 +0000
Message-ID: <CAEX2NSd7GAHa+-ge6r8RORnyLBV0j6ET5L1iMNH+YOWhO2VCgw@mail.gmail.com>
To: Marcel Jamin <marcel@jamin.net>,
Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>,
Luke Dashjr <luke@dashjr.org>
Content-Type: multipart/alternative; boundary=001a11444496ba3715054aa0a2db
X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, HTML_MESSAGE,
RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
smtp1.linux-foundation.org
X-Mailman-Approved-At: Mon, 13 Mar 2017 18:13:47 +0000
Subject: Re: [bitcoin-dev] Currency/exchange rate information API
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org>
List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>,
<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>,
<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe>
X-List-Received-Date: Mon, 13 Mar 2017 18:11:11 -0000
--001a11444496ba3715054aa0a2db
Content-Type: text/plain; charset=UTF-8
This formatting of JSON isn't unheard of though, it's typically called JSON
Streaming[1]. As long as exchanges implementing the API actually follow the
BIP and keep one JSON object per line, it shouldn't be a problem to decode.
1. https://en.wikipedia.org/wiki/JSON_Streaming
On Tue, Mar 7, 2017 at 8:07 AM Marcel Jamin via bitcoin-dev <
bitcoin-dev@lists.linuxfoundation.org> wrote:
> > Why are multiple results separated by a line-feed rather than using a
> JSON Array?
> > * Clients ought to cache historical data, and using a line-feed format
> allows them to simply append to a cache file.
> > * Parsing JSON typically requires the entire data parsed together as a
> single memory object. Using simple lines to separate results, however,
> allows parsing a single result at a time.
> > What if long descriptions require line and paragraph breaks?
> > * Clients should word-wrap long lines, and JSON escapes newlines as "\n"
> which can be used doubly ("\n\n") for paragraph breaks.
>
> I'd file this under premature optimization at the cost of
> interoperability. If you use JSON, then please use it properly.
>
> I'd also say it's the job of the parser to offer a way of doing that,
> e.g. in .NET you can easily achieve that with Newtonsoft's JSON
> parser:
> http://stackoverflow.com/questions/20374083/deserialize-json-array-stream-one-item-at-a-time
> .
>
> On 4 March 2017 at 09:27, Luke Dashjr via bitcoin-dev
> <bitcoin-dev@lists.linuxfoundation.org> wrote:
> >
> > Investigating what it would take to add fiat currency information to
> Bitcoin
> > Knots, I noticed Electrum currently has many implementations, one for
> each
> > exchange rate provider, due to lack of a common format for such data.
> >
> > Therefore, I put together an initial draft of a BIP that could
> standardise
> > this so wallets (or other software) and exchange rate providers can
> simply
> > interoperate without a lot of overhead reimplementing the same thing many
> > ways.
> >
> > One thing I am unsure about, is that currently this draft requires using
> XBT
> > (as BTC) for Bitcoin amounts. It would seem nicer to use satoshis, but
> those
> > don't really have a pseudo-ISO currency code to fit in nicely...
> >
> > Current draft here:
> >
> https://github.com/luke-jr/bips/blob/bip-xchgrate/bip-xchgrate.mediawiki
> >
> > Thoughts? Anything critical missing? Ways to make the interface better?
> >
> > Luke
> > _______________________________________________
> > bitcoin-dev mailing list
> > bitcoin-dev@lists.linuxfoundation.org
> > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>
--001a11444496ba3715054aa0a2db
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">This formatting of JSON isn't unheard of though, it=
9;s typically called JSON Streaming[1]. As long as exchanges implementing t=
he API actually follow the BIP and keep one JSON object per line, it should=
n't be a problem to decode.<div><br></div><div>1.=C2=A0<a href=3D"https=
://en.wikipedia.org/wiki/JSON_Streaming">https://en.wikipedia.org/wiki/JSON=
_Streaming</a></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr">O=
n Tue, Mar 7, 2017 at 8:07 AM Marcel Jamin via bitcoin-dev <<a href=3D"m=
ailto:bitcoin-dev@lists.linuxfoundation.org">bitcoin-dev@lists.linuxfoundat=
ion.org</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"=
margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> Why are=
multiple results separated by a line-feed rather than using a JSON Array?<=
br class=3D"gmail_msg">
> * Clients ought to cache historical data, and using a line-feed format=
allows them to simply append to a cache file.<br class=3D"gmail_msg">
> * Parsing JSON typically requires the entire data parsed together as a=
single memory object. Using simple lines to separate results, however, all=
ows parsing a single result at a time.<br class=3D"gmail_msg">
> What if long descriptions require line and paragraph breaks?<br class=
=3D"gmail_msg">
> * Clients should word-wrap long lines, and JSON escapes newlines as &q=
uot;\n" which can be used doubly ("\n\n") for paragraph brea=
ks.<br class=3D"gmail_msg">
<br class=3D"gmail_msg">
I'd file this under premature optimization at the cost of<br class=3D"g=
mail_msg">
interoperability. If you use JSON, then please use it properly.<br class=3D=
"gmail_msg">
<br class=3D"gmail_msg">
I'd also say it's the job of the parser to offer a way of doing tha=
t,<br class=3D"gmail_msg">
e.g. in .NET you can easily achieve that with Newtonsoft's JSON<br clas=
s=3D"gmail_msg">
parser: <a href=3D"http://stackoverflow.com/questions/20374083/deserialize-=
json-array-stream-one-item-at-a-time" rel=3D"noreferrer" class=3D"gmail_msg=
" target=3D"_blank">http://stackoverflow.com/questions/20374083/deserialize=
-json-array-stream-one-item-at-a-time</a>.<br class=3D"gmail_msg">
<br class=3D"gmail_msg">
On 4 March 2017 at 09:27, Luke Dashjr via bitcoin-dev<br class=3D"gmail_msg=
">
<<a href=3D"mailto:bitcoin-dev@lists.linuxfoundation.org" class=3D"gmail=
_msg" target=3D"_blank">bitcoin-dev@lists.linuxfoundation.org</a>> wrote=
:<br class=3D"gmail_msg">
><br class=3D"gmail_msg">
> Investigating what it would take to add fiat currency information to B=
itcoin<br class=3D"gmail_msg">
> Knots, I noticed Electrum currently has many implementations, one for =
each<br class=3D"gmail_msg">
> exchange rate provider, due to lack of a common format for such data.<=
br class=3D"gmail_msg">
><br class=3D"gmail_msg">
> Therefore, I put together an initial draft of a BIP that could standar=
dise<br class=3D"gmail_msg">
> this so wallets (or other software) and exchange rate providers can si=
mply<br class=3D"gmail_msg">
> interoperate without a lot of overhead reimplementing the same thing m=
any<br class=3D"gmail_msg">
> ways.<br class=3D"gmail_msg">
><br class=3D"gmail_msg">
> One thing I am unsure about, is that currently this draft requires usi=
ng XBT<br class=3D"gmail_msg">
> (as BTC) for Bitcoin amounts. It would seem nicer to use satoshis, but=
those<br class=3D"gmail_msg">
> don't really have a pseudo-ISO currency code to fit in nicely...<b=
r class=3D"gmail_msg">
><br class=3D"gmail_msg">
> Current draft here:<br class=3D"gmail_msg">
>=C2=A0 =C2=A0 =C2=A0<a href=3D"https://github.com/luke-jr/bips/blob/bip=
-xchgrate/bip-xchgrate.mediawiki" rel=3D"noreferrer" class=3D"gmail_msg" ta=
rget=3D"_blank">https://github.com/luke-jr/bips/blob/bip-xchgrate/bip-xchgr=
ate.mediawiki</a><br class=3D"gmail_msg">
><br class=3D"gmail_msg">
> Thoughts? Anything critical missing? Ways to make the interface better=
?<br class=3D"gmail_msg">
><br class=3D"gmail_msg">
> Luke<br class=3D"gmail_msg">
> _______________________________________________<br class=3D"gmail_msg"=
>
> bitcoin-dev mailing list<br class=3D"gmail_msg">
> <a href=3D"mailto:bitcoin-dev@lists.linuxfoundation.org" class=3D"gmai=
l_msg" target=3D"_blank">bitcoin-dev@lists.linuxfoundation.org</a><br class=
=3D"gmail_msg">
> <a href=3D"https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-=
dev" rel=3D"noreferrer" class=3D"gmail_msg" target=3D"_blank">https://lists=
.linuxfoundation.org/mailman/listinfo/bitcoin-dev</a><br class=3D"gmail_msg=
">
_______________________________________________<br class=3D"gmail_msg">
bitcoin-dev mailing list<br class=3D"gmail_msg">
<a href=3D"mailto:bitcoin-dev@lists.linuxfoundation.org" class=3D"gmail_msg=
" target=3D"_blank">bitcoin-dev@lists.linuxfoundation.org</a><br class=3D"g=
mail_msg">
<a href=3D"https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev" =
rel=3D"noreferrer" class=3D"gmail_msg" target=3D"_blank">https://lists.linu=
xfoundation.org/mailman/listinfo/bitcoin-dev</a><br class=3D"gmail_msg">
</blockquote></div>
--001a11444496ba3715054aa0a2db--
|