FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
StockSharp/Algo/SecurityMappingMessageAdapter.cs at master · StockSharp/StockSharp · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
StockSharp
/
StockSharp
Public
Notifications
You must be signed in to change notification settings
Fork
2.3k
Star
10.7k
Code
Issues
1
Pull requests
1
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
StockSharp
/
Algo
/
SecurityMappingMessageAdapter.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
73 lines (62 loc) · 2.63 KB
Breadcrumbs
StockSharp
/
Algo
/
SecurityMappingMessageAdapter.cs
Copy path
File metadata and controls
73 lines (62 loc) · 2.63 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
namespace
StockSharp
.
Algo
;
using
StockSharp
.
Algo
.
Storages
;
/// <summary>
/// Security identifier mappings message adapter.
/// </summary>
public
class
SecurityMappingMessageAdapter
:
MessageAdapterWrapper
{
private
readonly
ISecurityMappingManager
_manager
;
/// <summary>
/// Initializes a new instance of the <see cref="SecurityMappingMessageAdapter"/>.
/// </summary>
/// <param name="innerAdapter">The adapter, to which messages will be directed.</param>
/// <param name="provider">Security identifier mappings storage provider.</param>
public
SecurityMappingMessageAdapter
(
IMessageAdapter
innerAdapter
,
ISecurityMappingStorageProvider
provider
)
:
base
(
innerAdapter
)
{
Provider
=
provider
??
throw
new
ArgumentNullException
(
nameof
(
provider
)
)
;
_manager
=
new
SecurityMappingManager
(
provider
,
(
)
=>
StorageName
,
(
format
,
arg0
,
arg1
,
arg2
)
=>
LogInfo
(
format
,
arg0
,
arg1
,
arg2
)
)
;
}
/// <summary>
/// Initializes a new instance of the <see cref="SecurityMappingMessageAdapter"/> with a custom manager.
/// </summary>
/// <param name="innerAdapter">The adapter, to which messages will be directed.</param>
/// <param name="provider">Security identifier mappings storage provider.</param>
/// <param name="manager">Security mapping manager.</param>
public
SecurityMappingMessageAdapter
(
IMessageAdapter
innerAdapter
,
ISecurityMappingStorageProvider
provider
,
ISecurityMappingManager
manager
)
:
base
(
innerAdapter
)
{
Provider
=
provider
??
throw
new
ArgumentNullException
(
nameof
(
provider
)
)
;
_manager
=
manager
??
throw
new
ArgumentNullException
(
nameof
(
manager
)
)
;
}
/// <summary>
/// Security identifier mappings storage provider.
/// </summary>
public
ISecurityMappingStorageProvider
Provider
{
get
;
}
/// <inheritdoc />
protected
override
async
ValueTask
OnInnerAdapterNewOutMessageAsync
(
Message
message
,
CancellationToken
cancellationToken
)
{
var
(
processedMessage
,
forward
)
=
_manager
.
ProcessOutMessage
(
message
)
;
if
(
forward
&&
processedMessage
!=
null
)
await
base
.
OnInnerAdapterNewOutMessageAsync
(
processedMessage
,
cancellationToken
)
;
}
/// <inheritdoc />
protected
override
ValueTask
OnSendInMessageAsync
(
Message
message
,
CancellationToken
cancellationToken
)
{
var
(
processedMessage
,
forward
)
=
_manager
.
ProcessInMessage
(
message
)
;
if
(
forward
&&
processedMessage
!=
null
)
return
base
.
OnSendInMessageAsync
(
processedMessage
,
cancellationToken
)
;
return
default
;
}
/// <summary>
/// Create a copy of <see cref="SecurityMappingMessageAdapter"/>.
/// </summary>
/// <returns>Copy.</returns>
public
override
IMessageAdapter
Clone
(
)
{
return
new
SecurityMappingMessageAdapter
(
InnerAdapter
.
TypedClone
(
)
,
Provider
)
;
}
}
Back
|
FazBrowse Home
|
New Git URL