forked from gofinance/ib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
49 lines (42 loc) · 695 Bytes
/
types.go
File metadata and controls
49 lines (42 loc) · 695 Bytes
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
package ib
import (
"bytes"
)
// Request .
type Request interface {
writable
code() OutgoingMessageID
version() int64
}
// Reply .
type Reply interface {
readable
code() IncomingMessageID
}
// MatchedRequest .
type MatchedRequest interface {
Request
SetId(id int64)
ID() int64
}
// MatchedReply .
type MatchedReply interface {
Reply
ID() int64
}
type clientHandshake struct {
version int64
id int64
}
func (c *clientHandshake) write(b *bytes.Buffer) error {
if err := writeInt(b, c.version); err != nil {
return err
}
if err := writeInt(b, mStartAPI); err != nil {
return err
}
if err := writeInt(b, 1); err != nil {
return err
}
return writeInt(b, c.id)
}